Download and run monero wallet rpc on swap cli startup

If the monero wallet rpc has not already been downloaded we download the monero cli package and extract the wallet rpc. The unneeded files are cleaned up. The monero wallet rpc is started on a random port which is provided to the swap cli.

We added a fork of tokio-tar via a git subtree because we needed a tokio-tar version that was compatible with tokio 1.0. Remove this subtree in favor of a regular cargo dependency when this PR merges: https://github.com/vorot93/tokio-tar/pull/3.
This commit is contained in:
rishflab 2021-02-24 18:08:25 +11:00 committed by Thomas Eizinger
parent 18ba8f49c4
commit 51c16f23d8
No known key found for this signature in database
GPG key ID: 651AC83A6C6C8B96
12 changed files with 354 additions and 52 deletions

View file

@ -98,10 +98,11 @@ impl<R: Read + Unpin> ArchiveBuilder<R> {
self
}
/// Ignore zeroed headers, which would otherwise indicate to the archive that it has no more
/// entries.
/// Ignore zeroed headers, which would otherwise indicate to the archive
/// that it has no more entries.
///
/// This can be used in case multiple tar archives have been concatenated together.
/// This can be used in case multiple tar archives have been concatenated
/// together.
pub fn set_ignore_zeros(mut self, ignore_zeros: bool) -> Self {
self.ignore_zeros = ignore_zeros;
self
@ -365,8 +366,8 @@ fn poll_next_raw<R: Read + Unpin>(
}
// If a header is not all zeros, we have another valid header.
// Otherwise, check if we are ignoring zeros and continue, or break as if this is the
// end of the archive.
// Otherwise, check if we are ignoring zeros and continue, or break as if this
// is the end of the archive.
if !header.as_bytes().iter().all(|i| *i == 0) {
*next += 512;
break;
@ -559,8 +560,8 @@ impl<R: Read + Unpin> Read for Archive<R> {
/// Try to fill the buffer from the reader.
///
/// If the reader reaches its end before filling the buffer at all, returns `false`.
/// Otherwise returns `true`.
/// If the reader reaches its end before filling the buffer at all, returns
/// `false`. Otherwise returns `true`.
fn poll_try_read_all<R: Read + Unpin>(
mut source: R,
cx: &mut Context<'_>,

View file

@ -597,7 +597,8 @@ async fn append_dir_all<Dst: Write + Unpin + ?Sized>(
while let Some((src, is_dir, is_symlink)) = stack.pop() {
let dest = path.join(src.strip_prefix(&src_path).unwrap());
// In case of a symlink pointing to a directory, is_dir is false, but src.is_dir() will return true
// In case of a symlink pointing to a directory, is_dir is false, but
// src.is_dir() will return true
if is_dir || (is_symlink && follow && src.is_dir()) {
let mut entries = fs::read_dir(&src).await?;
while let Some(entry) = entries.next_entry().await.transpose() {

View file

@ -144,8 +144,8 @@ impl<R: Read + Unpin> Entry<R> {
/// Returns the link name for this entry, in bytes, if listed.
///
/// Note that this will not always return the same value as
/// `self.header().link_name_bytes()` as some archive formats have support for
/// longer path names described in separate entries.
/// `self.header().link_name_bytes()` as some archive formats have support
/// for longer path names described in separate entries.
pub fn link_name_bytes(&self) -> Option<Cow<[u8]>> {
self.fields.link_name_bytes()
}
@ -414,14 +414,12 @@ impl<R: Read + Unpin> EntryFields<R> {
async fn unpack_in(&mut self, dst: &Path) -> io::Result<bool> {
// Notes regarding bsdtar 2.8.3 / libarchive 2.8.3:
// * Leading '/'s are trimmed. For example, `///test` is treated as
// `test`.
// * If the filename contains '..', then the file is skipped when
// extracting the tarball.
// * '//' within a filename is effectively skipped. An error is
// logged, but otherwise the effect is as if any two or more
// adjacent '/'s within the filename were consolidated into one
// '/'.
// * Leading '/'s are trimmed. For example, `///test` is treated as `test`.
// * If the filename contains '..', then the file is skipped when extracting the
// tarball.
// * '//' within a filename is effectively skipped. An error is logged, but
// otherwise the effect is as if any two or more adjacent '/'s within the
// filename were consolidated into one '/'.
//
// Most of this is handled by the `path` module of the standard
// library, but we specially handle a few cases here as well.

View file

@ -777,7 +777,8 @@ impl Header {
#[cfg(windows)]
fn fill_platform_from(&mut self, meta: &Metadata, mode: HeaderMode) {
// There's no concept of a file mode on Windows, so do a best approximation here.
// There's no concept of a file mode on Windows, so do a best approximation
// here.
match mode {
HeaderMode::Complete => {
self.set_uid(0);
@ -1100,7 +1101,8 @@ impl GnuHeader {
truncate(&self.uname)
}
/// Gets the fullname (group:user) in a "lossy" way, used for error reporting ONLY.
/// Gets the fullname (group:user) in a "lossy" way, used for error
/// reporting ONLY.
fn fullname_lossy(&self) -> String {
format!(
"{}:{}",