mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-05-20 15:40:48 -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
|
@ -15,6 +15,9 @@ pub enum Alice {
|
|||
Started {
|
||||
state3: alice::State3,
|
||||
},
|
||||
BtcLockTransactionSeen {
|
||||
state3: alice::State3,
|
||||
},
|
||||
BtcLocked {
|
||||
state3: alice::State3,
|
||||
},
|
||||
|
@ -81,6 +84,9 @@ impl From<&AliceState> for Alice {
|
|||
AliceState::Started { state3 } => Alice::Started {
|
||||
state3: state3.as_ref().clone(),
|
||||
},
|
||||
AliceState::BtcLockTransactionSeen { state3 } => Alice::BtcLockTransactionSeen {
|
||||
state3: state3.as_ref().clone(),
|
||||
},
|
||||
AliceState::BtcLocked { state3 } => Alice::BtcLocked {
|
||||
state3: state3.as_ref().clone(),
|
||||
},
|
||||
|
@ -179,6 +185,9 @@ impl From<Alice> for AliceState {
|
|||
Alice::Started { state3 } => AliceState::Started {
|
||||
state3: Box::new(state3),
|
||||
},
|
||||
Alice::BtcLockTransactionSeen { state3 } => AliceState::BtcLockTransactionSeen {
|
||||
state3: Box::new(state3),
|
||||
},
|
||||
Alice::BtcLocked { state3 } => AliceState::BtcLocked {
|
||||
state3: Box::new(state3),
|
||||
},
|
||||
|
@ -278,6 +287,9 @@ impl fmt::Display for Alice {
|
|||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Alice::Started { .. } => write!(f, "Started"),
|
||||
Alice::BtcLockTransactionSeen { .. } => {
|
||||
write!(f, "Bitcoin lock transaction in mempool")
|
||||
}
|
||||
Alice::BtcLocked { .. } => f.write_str("Bitcoin locked"),
|
||||
Alice::XmrLockTransactionSent { .. } => f.write_str("Monero lock transaction sent"),
|
||||
Alice::XmrLocked { .. } => f.write_str("Monero locked"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue