|
|
|
@ -7,7 +7,9 @@ use monero_harness::{image, Monero};
|
|
|
|
|
use std::{path::PathBuf, sync::Arc};
|
|
|
|
|
use swap::{
|
|
|
|
|
bitcoin,
|
|
|
|
|
config::Config,
|
|
|
|
|
bitcoin::Timelock,
|
|
|
|
|
config,
|
|
|
|
|
config::{Config, GetConfig},
|
|
|
|
|
monero,
|
|
|
|
|
protocol::{alice, alice::AliceState, bob, bob::BobState, SwapAmounts},
|
|
|
|
|
seed::Seed,
|
|
|
|
@ -302,7 +304,7 @@ impl TestContext {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub async fn setup_test<T, F>(testfn: T)
|
|
|
|
|
pub async fn setup_test<T, F>(config: Config, testfn: T)
|
|
|
|
|
where
|
|
|
|
|
T: Fn(TestContext) -> F,
|
|
|
|
|
F: Future<Output = ()>,
|
|
|
|
@ -318,8 +320,6 @@ where
|
|
|
|
|
xmr: monero::Amount::from_piconero(1_000_000_000_000),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let config = Config::regtest();
|
|
|
|
|
|
|
|
|
|
let alice_starting_balances = StartingBalances {
|
|
|
|
|
xmr: swap_amounts.xmr * 10,
|
|
|
|
|
btc: bitcoin::Amount::ZERO,
|
|
|
|
@ -511,3 +511,37 @@ pub mod bob_run_until {
|
|
|
|
|
matches!(state, BobState::EncSigSent(..))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct SlowCancelConfig;
|
|
|
|
|
|
|
|
|
|
impl GetConfig for SlowCancelConfig {
|
|
|
|
|
fn get_config() -> Config {
|
|
|
|
|
Config {
|
|
|
|
|
bitcoin_cancel_timelock: Timelock::new(180),
|
|
|
|
|
..config::Regtest::get_config()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct FastCancelConfig;
|
|
|
|
|
|
|
|
|
|
impl GetConfig for FastCancelConfig {
|
|
|
|
|
fn get_config() -> Config {
|
|
|
|
|
Config {
|
|
|
|
|
bitcoin_cancel_timelock: Timelock::new(1),
|
|
|
|
|
..config::Regtest::get_config()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct FastPunishConfig;
|
|
|
|
|
|
|
|
|
|
impl GetConfig for FastPunishConfig {
|
|
|
|
|
fn get_config() -> Config {
|
|
|
|
|
Config {
|
|
|
|
|
bitcoin_cancel_timelock: Timelock::new(1),
|
|
|
|
|
bitcoin_punish_timelock: Timelock::new(1),
|
|
|
|
|
..config::Regtest::get_config()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|