Make monero finality calculation clearer

This commit is contained in:
rishflab 2020-12-07 13:43:23 +11:00
parent b4ac69fa9c
commit 282997c105

View File

@ -15,7 +15,8 @@ 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,
monero_max_finality_time: *mainnet::MONERO_AVG_BLOCK_TIME
* mainnet::MONERO_FINALITY_CONFIRMATIONS,
}
}
@ -24,7 +25,8 @@ 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,
monero_max_finality_time: *regtest::MONERO_AVG_BLOCK_TIME
* regtest::MONERO_FINALITY_CONFIRMATIONS,
}
}
}
@ -39,20 +41,22 @@ mod mainnet {
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));
pub static MONERO_FINALITY_CONFIRMATIONS: u32 = 10;
pub static MONERO_AVG_BLOCK_TIME: Lazy<Duration> = Lazy::new(|| Duration::from_secs(2 * 60));
}
mod regtest {
use super::*;
// In test, set to 5 seconds to fail fast
// In test, we set a shorter time to fail fast
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));
pub static MONERO_FINALITY_CONFIRMATIONS: u32 = 1;
pub static MONERO_AVG_BLOCK_TIME: Lazy<Duration> = Lazy::new(|| Duration::from_secs(5));
}