mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-05-02 14:56:10 -04:00
Add alice punish test
Use reusable test init functions for happy path test Extract tracing setup to reusable function Move test initialization to seperate functions Increase stack size in CI Fix monero max finality time Force Bob swarm polling to send message 2 Run Bob state to xmr_locked in punish test to force the sending of message2. Previously Bob state was run until btc_locked. Although this was the right thing to do, message2 was not being sent as the swarm was not polled in btc_locked. Alice punish test passes. Add info logging to executor
This commit is contained in:
parent
5fef68322a
commit
c91e9652aa
8 changed files with 731 additions and 540 deletions
|
@ -799,6 +799,9 @@ impl State4 {
|
|||
t1_timeout.await;
|
||||
Ok(())
|
||||
}
|
||||
pub fn tx_lock_id(&self) -> bitcoin::Txid {
|
||||
self.tx_lock.txid()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
|
|
|
@ -6,6 +6,7 @@ pub struct Config {
|
|||
pub bob_time_to_act: Duration,
|
||||
pub bitcoin_finality_confirmations: u32,
|
||||
pub bitcoin_avg_block_time: Duration,
|
||||
pub monero_max_finality_time: Duration,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
|
@ -14,6 +15,7 @@ impl Config {
|
|||
bob_time_to_act: *mainnet::BOB_TIME_TO_ACT,
|
||||
bitcoin_finality_confirmations: mainnet::BITCOIN_FINALITY_CONFIRMATIONS,
|
||||
bitcoin_avg_block_time: *mainnet::BITCOIN_AVG_BLOCK_TIME,
|
||||
monero_max_finality_time: *mainnet::MONERO_MAX_FINALITY_TIME,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +24,7 @@ impl Config {
|
|||
bob_time_to_act: *regtest::BOB_TIME_TO_ACT,
|
||||
bitcoin_finality_confirmations: regtest::BITCOIN_FINALITY_CONFIRMATIONS,
|
||||
bitcoin_avg_block_time: *regtest::BITCOIN_AVG_BLOCK_TIME,
|
||||
monero_max_finality_time: *regtest::MONERO_MAX_FINALITY_TIME,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,15 +38,21 @@ mod mainnet {
|
|||
pub static BITCOIN_FINALITY_CONFIRMATIONS: u32 = 3;
|
||||
|
||||
pub static BITCOIN_AVG_BLOCK_TIME: Lazy<Duration> = Lazy::new(|| Duration::from_secs(10 * 60));
|
||||
|
||||
pub static MONERO_MAX_FINALITY_TIME: Lazy<Duration> =
|
||||
Lazy::new(|| Duration::from_secs_f64(15f64 * 1.5 * 2f64 * 60f64));
|
||||
}
|
||||
|
||||
mod regtest {
|
||||
use super::*;
|
||||
|
||||
// In test, set to 5 seconds to fail fast
|
||||
pub static BOB_TIME_TO_ACT: Lazy<Duration> = Lazy::new(|| Duration::from_secs(10));
|
||||
pub static BOB_TIME_TO_ACT: Lazy<Duration> = Lazy::new(|| Duration::from_secs(30));
|
||||
|
||||
pub static BITCOIN_FINALITY_CONFIRMATIONS: u32 = 1;
|
||||
|
||||
pub static BITCOIN_AVG_BLOCK_TIME: Lazy<Duration> = Lazy::new(|| Duration::from_secs(5));
|
||||
|
||||
pub static MONERO_MAX_FINALITY_TIME: Lazy<Duration> =
|
||||
Lazy::new(|| Duration::from_secs_f64(60f64));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue