merge upstream and fix some tests

This commit is contained in:
Lorenzo Tucci 2023-09-01 12:06:13 +03:00
commit 9b08f71bb8
No known key found for this signature in database
GPG key ID: D98C4FA2CDF590A0
4 changed files with 42 additions and 69 deletions

View file

@ -90,8 +90,8 @@ impl SwapLock {
/// # Notes
/// The 50ms polling interval is considered negligible overhead compared to the typical time required to suspend ongoing swap processes.
pub async fn send_suspend_signal(&self) -> Result<(), Error> {
const TIMEOUT: u64 = 10_000;
const INTERVAL: u64 = 50;
const TIMEOUT: i32 = 10_000;
const INTERVAL: i32 = 50;
let _ = self.suspension_trigger.send(())?;
@ -295,7 +295,6 @@ pub mod api_test {
use libp2p::Multiaddr;
use std::str::FromStr;
use tokio::sync::broadcast;
use uuid::Uuid;
pub const MULTI_ADDRESS: &str =
@ -333,7 +332,7 @@ pub mod api_test {
}
impl Request {
pub fn buy_xmr(is_testnet: bool, tx: broadcast::Sender<()>) -> Request {
pub fn buy_xmr(is_testnet: bool) -> Request {
let seller = Multiaddr::from_str(MULTI_ADDRESS).unwrap();
let bitcoin_change_address = {
if is_testnet {
@ -352,43 +351,35 @@ pub mod api_test {
};
Request::new(
Method::BuyXmr,
Params {
seller: Some(seller),
bitcoin_change_address: Some(bitcoin_change_address),
monero_receive_address: Some(monero_receive_address),
swap_id: Some(Uuid::new_v4()),
..Default::default()
Method::BuyXmr {
seller,
bitcoin_change_address,
monero_receive_address,
swap_id: Uuid::new_v4(),
},
)
}
pub fn resume() -> Request {
Request::new(
Method::Resume,
Params {
swap_id: Some(Uuid::from_str(SWAP_ID).unwrap()),
..Default::default()
Method::Resume {
swap_id: Uuid::from_str(SWAP_ID).unwrap(),
},
)
}
pub fn cancel() -> Request {
Request::new(
Method::CancelAndRefund,
Params {
swap_id: Some(Uuid::from_str(SWAP_ID).unwrap()),
..Default::default()
Method::CancelAndRefund {
swap_id: Uuid::from_str(SWAP_ID).unwrap(),
},
)
}
pub fn refund() -> Request {
Request::new(
Method::CancelAndRefund,
Params {
swap_id: Some(Uuid::from_str(SWAP_ID).unwrap()),
..Default::default()
Method::CancelAndRefund {
swap_id: Uuid::from_str(SWAP_ID).unwrap(),
},
)
}