diff --git a/swap/Cargo.toml b/swap/Cargo.toml index f2075aff..12886cdd 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -55,7 +55,7 @@ structopt = "0.3" strum = { version = "0.24", features = [ "derive" ] } thiserror = "1" 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-tungstenite = { version = "0.15", features = [ "rustls-tls" ] } tokio-util = { version = "0.7", features = [ "io", "codec" ] } diff --git a/swap/src/api.rs b/swap/src/api.rs index 9ad8cea5..144d4f39 100644 --- a/swap/src/api.rs +++ b/swap/src/api.rs @@ -123,7 +123,7 @@ impl SwapLock { // workaround for warning over monero_rpc_process which we must own but not read #[allow(dead_code)] pub struct Context { - db: Arc, + pub db: Arc, bitcoin_wallet: Option>, monero_wallet: Option>, monero_rpc_process: Option, diff --git a/swap/src/cli/command.rs b/swap/src/cli/command.rs index 0b95627b..242b48ce 100644 --- a/swap/src/cli/command.rs +++ b/swap/src/cli/command.rs @@ -538,13 +538,10 @@ mod tests { ); // since Uuid is random, copy before comparing requests - if let Method::BuyXmr { - ref mut swap_id, .. - } = expected_request.cmd - { + if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd { *swap_id = match actual_request.cmd { - Method::BuyXmr { swap_id, .. } => swap_id, - _ => panic!("Not the Method we expected"), + Method::BuyXmr { swap_id, .. } => { swap_id }, + _ => panic!("Not the Method we expected") } }; @@ -577,13 +574,10 @@ mod tests { _ => panic!("Couldn't parse result"), }; - if let Method::BuyXmr { - ref mut swap_id, .. - } = expected_request.cmd - { + if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd { *swap_id = match actual_request.cmd { - Method::BuyXmr { swap_id, .. } => swap_id, - _ => panic!("Not the Method we expected"), + Method::BuyXmr { swap_id, .. } => { swap_id }, + _ => panic!("Not the Method we expected") } }; @@ -777,13 +771,10 @@ mod tests { _ => panic!("Couldn't parse result"), }; - if let Method::BuyXmr { - ref mut swap_id, .. - } = expected_request.cmd - { + if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd { *swap_id = match actual_request.cmd { - Method::BuyXmr { swap_id, .. } => swap_id, - _ => panic!("Not the Method we expected"), + Method::BuyXmr { swap_id, .. } => { swap_id }, + _ => panic!("Not the Method we expected") } }; @@ -819,13 +810,10 @@ mod tests { _ => panic!("Couldn't parse result"), }; - if let Method::BuyXmr { - ref mut swap_id, .. - } = expected_request.cmd - { + if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd { *swap_id = match actual_request.cmd { - Method::BuyXmr { swap_id, .. } => swap_id, - _ => panic!("Not the Method we expected"), + Method::BuyXmr { swap_id, .. } => { swap_id }, + _ => panic!("Not the Method we expected") } }; @@ -851,13 +839,10 @@ mod tests { Request::resume(), ); - if let Method::BuyXmr { - ref mut swap_id, .. - } = expected_request.cmd - { + if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd { *swap_id = match actual_request.cmd { - Method::BuyXmr { swap_id, .. } => swap_id, - _ => panic!("Not the Method we expected"), + Method::BuyXmr { swap_id, .. } => { swap_id }, + _ => panic!("Not the Method we expected") } }; @@ -923,13 +908,10 @@ mod tests { _ => panic!("Couldn't parse result"), }; - if let Method::BuyXmr { - ref mut swap_id, .. - } = expected_request.cmd - { + if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd { *swap_id = match actual_request.cmd { - Method::BuyXmr { swap_id, .. } => swap_id, - _ => panic!("Not the Method we expected"), + Method::BuyXmr { swap_id, .. } => { swap_id }, + _ => panic!("Not the Method we expected") } }; @@ -963,13 +945,10 @@ mod tests { _ => panic!("Couldn't parse result"), }; - if let Method::BuyXmr { - ref mut swap_id, .. - } = expected_request.cmd - { + if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd { *swap_id = match actual_request.cmd { - Method::BuyXmr { swap_id, .. } => swap_id, - _ => panic!("Not the Method we expected"), + Method::BuyXmr { swap_id, .. } => { swap_id }, + _ => panic!("Not the Method we expected") } }; @@ -992,13 +971,10 @@ mod tests { _ => panic!("Couldn't parse result"), }; - if let Method::BuyXmr { - ref mut swap_id, .. - } = expected_request.cmd - { + if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd { *swap_id = match actual_request.cmd { - Method::BuyXmr { swap_id, .. } => swap_id, - _ => panic!("Not the Method we expected"), + Method::BuyXmr { swap_id, .. } => { swap_id }, + _ => panic!("Not the Method we expected") } }; @@ -1057,13 +1033,10 @@ mod tests { _ => panic!("Couldn't parse result"), }; - if let Method::BuyXmr { - ref mut swap_id, .. - } = expected_request.cmd - { + if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd { *swap_id = match actual_request.cmd { - Method::BuyXmr { swap_id, .. } => swap_id, - _ => panic!("Not the Method we expected"), + Method::BuyXmr { swap_id, .. } => { swap_id }, + _ => panic!("Not the Method we expected") } }; @@ -1097,13 +1070,10 @@ mod tests { _ => panic!("Couldn't parse result"), }; - if let Method::BuyXmr { - ref mut swap_id, .. - } = expected_request.cmd - { + if let Method::BuyXmr { ref mut swap_id, .. } = expected_request.cmd { *swap_id = match actual_request.cmd { - Method::BuyXmr { swap_id, .. } => swap_id, - _ => panic!("Not the Method we expected"), + Method::BuyXmr { swap_id, .. } => { swap_id }, + _ => panic!("Not the Method we expected") } };