mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-26 07:59:28 -05:00
Fix monero blocktime config
This commit is contained in:
parent
1a2857af29
commit
bd8e6e36e0
@ -10,9 +10,9 @@ use swap::{
|
|||||||
};
|
};
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
use testcontainers::clients::Cli;
|
use testcontainers::clients::Cli;
|
||||||
|
use tracing_subscriber::util::SubscriberInitExt as _;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use xmr_btc::{bitcoin, config::Config, cross_curve_dleq};
|
use xmr_btc::{bitcoin, config::Config, cross_curve_dleq};
|
||||||
use tracing_subscriber::util::SubscriberInitExt as _;
|
|
||||||
|
|
||||||
/// Run the following tests with RUST_MIN_STACK=10000000
|
/// 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.
|
/// the encsig and fail to refund or redeem. Alice punishes.
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn alice_punishes_if_bob_never_acts_after_fund() {
|
async fn alice_punishes_if_bob_never_acts_after_fund() {
|
||||||
|
|
||||||
let _guard = tracing_subscriber::fmt()
|
let _guard = tracing_subscriber::fmt()
|
||||||
.with_env_filter("trace,hyper=warn")
|
.with_env_filter("trace,hyper=warn")
|
||||||
.set_default();
|
.set_default();
|
||||||
|
@ -15,7 +15,9 @@ impl Config {
|
|||||||
bob_time_to_act: *mainnet::BOB_TIME_TO_ACT,
|
bob_time_to_act: *mainnet::BOB_TIME_TO_ACT,
|
||||||
bitcoin_finality_confirmations: mainnet::BITCOIN_FINALITY_CONFIRMATIONS,
|
bitcoin_finality_confirmations: mainnet::BITCOIN_FINALITY_CONFIRMATIONS,
|
||||||
bitcoin_avg_block_time: *mainnet::BITCOIN_AVG_BLOCK_TIME,
|
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,
|
* mainnet::MONERO_FINALITY_CONFIRMATIONS,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -25,7 +27,9 @@ impl Config {
|
|||||||
bob_time_to_act: *regtest::BOB_TIME_TO_ACT,
|
bob_time_to_act: *regtest::BOB_TIME_TO_ACT,
|
||||||
bitcoin_finality_confirmations: regtest::BITCOIN_FINALITY_CONFIRMATIONS,
|
bitcoin_finality_confirmations: regtest::BITCOIN_FINALITY_CONFIRMATIONS,
|
||||||
bitcoin_avg_block_time: *regtest::BITCOIN_AVG_BLOCK_TIME,
|
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,
|
* 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 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));
|
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_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));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user