mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-16 17:14:13 -05:00
Merge branch 'rpc-server' of https://github.com/yamabiiko/xmr-btc-swap into rpc-server
This commit is contained in:
commit
d7b0d068b6
3 changed files with 32 additions and 62 deletions
|
|
@ -55,7 +55,7 @@ structopt = "0.3"
|
||||||
strum = { version = "0.24", features = [ "derive" ] }
|
strum = { version = "0.24", features = [ "derive" ] }
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
time = "0.3"
|
time = "0.3"
|
||||||
tokio = { version = "1", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] }
|
tokio = { version = "1", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net", "parking_lot" ] }
|
||||||
tokio-socks = "0.5"
|
tokio-socks = "0.5"
|
||||||
tokio-tungstenite = { version = "0.15", features = [ "rustls-tls" ] }
|
tokio-tungstenite = { version = "0.15", features = [ "rustls-tls" ] }
|
||||||
tokio-util = { version = "0.7", features = [ "io", "codec" ] }
|
tokio-util = { version = "0.7", features = [ "io", "codec" ] }
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ impl SwapLock {
|
||||||
// workaround for warning over monero_rpc_process which we must own but not read
|
// workaround for warning over monero_rpc_process which we must own but not read
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub struct Context {
|
pub struct Context {
|
||||||
db: Arc<dyn Database + Send + Sync>,
|
pub db: Arc<dyn Database + Send + Sync>,
|
||||||
bitcoin_wallet: Option<Arc<bitcoin::Wallet>>,
|
bitcoin_wallet: Option<Arc<bitcoin::Wallet>>,
|
||||||
monero_wallet: Option<Arc<monero::Wallet>>,
|
monero_wallet: Option<Arc<monero::Wallet>>,
|
||||||
monero_rpc_process: Option<monero::WalletRpcProcess>,
|
monero_rpc_process: Option<monero::WalletRpcProcess>,
|
||||||
|
|
|
||||||
|
|
@ -538,13 +538,10 @@ mod tests {
|
||||||
);
|
);
|
||||||
|
|
||||||
// since Uuid is random, copy before comparing requests
|
// since Uuid is random, copy before comparing requests
|
||||||
if let Method::BuyXmr {
|
if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd {
|
||||||
ref mut swap_id, ..
|
|
||||||
} = expected_request.cmd
|
|
||||||
{
|
|
||||||
*swap_id = match actual_request.cmd {
|
*swap_id = match actual_request.cmd {
|
||||||
Method::BuyXmr { swap_id, .. } => swap_id,
|
Method::BuyXmr { swap_id, .. } => { swap_id },
|
||||||
_ => panic!("Not the Method we expected"),
|
_ => panic!("Not the Method we expected")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -577,13 +574,10 @@ mod tests {
|
||||||
_ => panic!("Couldn't parse result"),
|
_ => panic!("Couldn't parse result"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Method::BuyXmr {
|
if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd {
|
||||||
ref mut swap_id, ..
|
|
||||||
} = expected_request.cmd
|
|
||||||
{
|
|
||||||
*swap_id = match actual_request.cmd {
|
*swap_id = match actual_request.cmd {
|
||||||
Method::BuyXmr { swap_id, .. } => swap_id,
|
Method::BuyXmr { swap_id, .. } => { swap_id },
|
||||||
_ => panic!("Not the Method we expected"),
|
_ => panic!("Not the Method we expected")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -777,13 +771,10 @@ mod tests {
|
||||||
_ => panic!("Couldn't parse result"),
|
_ => panic!("Couldn't parse result"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Method::BuyXmr {
|
if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd {
|
||||||
ref mut swap_id, ..
|
|
||||||
} = expected_request.cmd
|
|
||||||
{
|
|
||||||
*swap_id = match actual_request.cmd {
|
*swap_id = match actual_request.cmd {
|
||||||
Method::BuyXmr { swap_id, .. } => swap_id,
|
Method::BuyXmr { swap_id, .. } => { swap_id },
|
||||||
_ => panic!("Not the Method we expected"),
|
_ => panic!("Not the Method we expected")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -819,13 +810,10 @@ mod tests {
|
||||||
_ => panic!("Couldn't parse result"),
|
_ => panic!("Couldn't parse result"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Method::BuyXmr {
|
if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd {
|
||||||
ref mut swap_id, ..
|
|
||||||
} = expected_request.cmd
|
|
||||||
{
|
|
||||||
*swap_id = match actual_request.cmd {
|
*swap_id = match actual_request.cmd {
|
||||||
Method::BuyXmr { swap_id, .. } => swap_id,
|
Method::BuyXmr { swap_id, .. } => { swap_id },
|
||||||
_ => panic!("Not the Method we expected"),
|
_ => panic!("Not the Method we expected")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -851,13 +839,10 @@ mod tests {
|
||||||
Request::resume(),
|
Request::resume(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Method::BuyXmr {
|
if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd {
|
||||||
ref mut swap_id, ..
|
|
||||||
} = expected_request.cmd
|
|
||||||
{
|
|
||||||
*swap_id = match actual_request.cmd {
|
*swap_id = match actual_request.cmd {
|
||||||
Method::BuyXmr { swap_id, .. } => swap_id,
|
Method::BuyXmr { swap_id, .. } => { swap_id },
|
||||||
_ => panic!("Not the Method we expected"),
|
_ => panic!("Not the Method we expected")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -923,13 +908,10 @@ mod tests {
|
||||||
_ => panic!("Couldn't parse result"),
|
_ => panic!("Couldn't parse result"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Method::BuyXmr {
|
if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd {
|
||||||
ref mut swap_id, ..
|
|
||||||
} = expected_request.cmd
|
|
||||||
{
|
|
||||||
*swap_id = match actual_request.cmd {
|
*swap_id = match actual_request.cmd {
|
||||||
Method::BuyXmr { swap_id, .. } => swap_id,
|
Method::BuyXmr { swap_id, .. } => { swap_id },
|
||||||
_ => panic!("Not the Method we expected"),
|
_ => panic!("Not the Method we expected")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -963,13 +945,10 @@ mod tests {
|
||||||
_ => panic!("Couldn't parse result"),
|
_ => panic!("Couldn't parse result"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Method::BuyXmr {
|
if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd {
|
||||||
ref mut swap_id, ..
|
|
||||||
} = expected_request.cmd
|
|
||||||
{
|
|
||||||
*swap_id = match actual_request.cmd {
|
*swap_id = match actual_request.cmd {
|
||||||
Method::BuyXmr { swap_id, .. } => swap_id,
|
Method::BuyXmr { swap_id, .. } => { swap_id },
|
||||||
_ => panic!("Not the Method we expected"),
|
_ => panic!("Not the Method we expected")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -992,13 +971,10 @@ mod tests {
|
||||||
_ => panic!("Couldn't parse result"),
|
_ => panic!("Couldn't parse result"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Method::BuyXmr {
|
if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd {
|
||||||
ref mut swap_id, ..
|
|
||||||
} = expected_request.cmd
|
|
||||||
{
|
|
||||||
*swap_id = match actual_request.cmd {
|
*swap_id = match actual_request.cmd {
|
||||||
Method::BuyXmr { swap_id, .. } => swap_id,
|
Method::BuyXmr { swap_id, .. } => { swap_id },
|
||||||
_ => panic!("Not the Method we expected"),
|
_ => panic!("Not the Method we expected")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1057,13 +1033,10 @@ mod tests {
|
||||||
_ => panic!("Couldn't parse result"),
|
_ => panic!("Couldn't parse result"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Method::BuyXmr {
|
if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd {
|
||||||
ref mut swap_id, ..
|
|
||||||
} = expected_request.cmd
|
|
||||||
{
|
|
||||||
*swap_id = match actual_request.cmd {
|
*swap_id = match actual_request.cmd {
|
||||||
Method::BuyXmr { swap_id, .. } => swap_id,
|
Method::BuyXmr { swap_id, .. } => { swap_id },
|
||||||
_ => panic!("Not the Method we expected"),
|
_ => panic!("Not the Method we expected")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1097,13 +1070,10 @@ mod tests {
|
||||||
_ => panic!("Couldn't parse result"),
|
_ => panic!("Couldn't parse result"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Method::BuyXmr {
|
if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd {
|
||||||
ref mut swap_id, ..
|
|
||||||
} = expected_request.cmd
|
|
||||||
{
|
|
||||||
*swap_id = match actual_request.cmd {
|
*swap_id = match actual_request.cmd {
|
||||||
Method::BuyXmr { swap_id, .. } => swap_id,
|
Method::BuyXmr { swap_id, .. } => { swap_id },
|
||||||
_ => panic!("Not the Method we expected"),
|
_ => panic!("Not the Method we expected")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue