Fix monero blocktime config

This commit is contained in:
rishflab 2020-12-09 14:45:09 +11:00
parent 1a2857af29
commit bd8e6e36e0
2 changed files with 9 additions and 6 deletions

View File

@ -10,9 +10,9 @@ use swap::{
};
use tempfile::tempdir;
use testcontainers::clients::Cli;
use tracing_subscriber::util::SubscriberInitExt as _;
use uuid::Uuid;
use xmr_btc::{bitcoin, config::Config, cross_curve_dleq};
use tracing_subscriber::util::SubscriberInitExt as _;
/// Run the following tests with RUST_MIN_STACK=10000000
@ -109,7 +109,6 @@ async fn happy_path() {
/// the encsig and fail to refund or redeem. Alice punishes.
#[tokio::test]
async fn alice_punishes_if_bob_never_acts_after_fund() {
let _guard = tracing_subscriber::fmt()
.with_env_filter("trace,hyper=warn")
.set_default();

View File

@ -15,7 +15,9 @@ 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_AVG_BLOCK_TIME
// We apply a scaling factor (1.5) so that the swap is not aborted when the
// blockchain is slow
monero_max_finality_time: (*mainnet::MONERO_AVG_BLOCK_TIME).mul_f64(1.5)
* mainnet::MONERO_FINALITY_CONFIRMATIONS,
}
}
@ -25,7 +27,9 @@ 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_AVG_BLOCK_TIME
// We apply a scaling factor (1.5) so that the swap is not aborted when the
// blockchain is slow
monero_max_finality_time: (*regtest::MONERO_AVG_BLOCK_TIME).mul_f64(1.5)
* regtest::MONERO_FINALITY_CONFIRMATIONS,
}
}
@ -41,7 +45,7 @@ mod mainnet {
pub static BITCOIN_AVG_BLOCK_TIME: Lazy<Duration> = Lazy::new(|| Duration::from_secs(10 * 60));
pub static MONERO_FINALITY_CONFIRMATIONS: u32 = 10;
pub static MONERO_FINALITY_CONFIRMATIONS: u32 = 15;
pub static MONERO_AVG_BLOCK_TIME: Lazy<Duration> = Lazy::new(|| Duration::from_secs(2 * 60));
}
@ -58,5 +62,5 @@ mod regtest {
pub static MONERO_FINALITY_CONFIRMATIONS: u32 = 1;
pub static MONERO_AVG_BLOCK_TIME: Lazy<Duration> = Lazy::new(|| Duration::from_secs(5));
pub static MONERO_AVG_BLOCK_TIME: Lazy<Duration> = Lazy::new(|| Duration::from_secs(60));
}