mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-05 21:14:32 -04:00
ASB aborts if CLI does not lock BTC
Includes a new state that is used to await BTC lock tx finality. Upon starting the swap we initially only wait for the BTC lock tx to be seen in the mempool. This is guarded by a short timeout (3 mins), because it is assumed that in the current setup (sport_price + execution_setup only triggered upon funds being available already) the lock transaction should be picked up almost instanly after the execution setup succeeded.
This commit is contained in:
parent
c4c798ea20
commit
529de8d5fd
9 changed files with 53 additions and 4 deletions
|
@ -6,6 +6,7 @@ use time::NumericalStdDurationShort;
|
|||
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
pub struct Config {
|
||||
pub bitcoin_lock_mempool_timeout: Duration,
|
||||
pub bitcoin_lock_confirmed_timeout: Duration,
|
||||
pub bitcoin_finality_confirmations: u32,
|
||||
pub bitcoin_avg_block_time: Duration,
|
||||
|
@ -43,7 +44,8 @@ pub struct Regtest;
|
|||
impl GetConfig for Mainnet {
|
||||
fn get_config() -> Config {
|
||||
Config {
|
||||
bitcoin_lock_confirmed_timeout: 24.hours(),
|
||||
bitcoin_lock_mempool_timeout: 3.minutes(),
|
||||
bitcoin_lock_confirmed_timeout: 2.hours(),
|
||||
bitcoin_finality_confirmations: 2,
|
||||
bitcoin_avg_block_time: 10.minutes(),
|
||||
bitcoin_cancel_timelock: CancelTimelock::new(72),
|
||||
|
@ -59,7 +61,8 @@ impl GetConfig for Mainnet {
|
|||
impl GetConfig for Testnet {
|
||||
fn get_config() -> Config {
|
||||
Config {
|
||||
bitcoin_lock_confirmed_timeout: 12.hours(),
|
||||
bitcoin_lock_mempool_timeout: 3.minutes(),
|
||||
bitcoin_lock_confirmed_timeout: 1.hours(),
|
||||
bitcoin_finality_confirmations: 2,
|
||||
bitcoin_avg_block_time: 10.minutes(),
|
||||
bitcoin_cancel_timelock: CancelTimelock::new(12),
|
||||
|
@ -75,6 +78,7 @@ impl GetConfig for Testnet {
|
|||
impl GetConfig for Regtest {
|
||||
fn get_config() -> Config {
|
||||
Config {
|
||||
bitcoin_lock_mempool_timeout: 30.seconds(),
|
||||
bitcoin_lock_confirmed_timeout: 1.minutes(),
|
||||
bitcoin_finality_confirmations: 1,
|
||||
bitcoin_avg_block_time: 5.seconds(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue