Merge branch 'rpc-server' of https://github.com/yamabiiko/xmr-btc-swap into rpc-server

This commit is contained in:
binarybaron 2023-09-24 19:50:42 +02:00
commit d7b0d068b6
3 changed files with 32 additions and 62 deletions

View file

@ -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" ] }

View file

@ -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<dyn Database + Send + Sync>,
pub db: Arc<dyn Database + Send + Sync>,
bitcoin_wallet: Option<Arc<bitcoin::Wallet>>,
monero_wallet: Option<Arc<monero::Wallet>>,
monero_rpc_process: Option<monero::WalletRpcProcess>,

View file

@ -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")
}
};