mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-30 20:46:33 -05:00
merge upstream and fix some tests
This commit is contained in:
commit
9b08f71bb8
4 changed files with 42 additions and 69 deletions
|
|
@ -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(),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue