diff --git a/xmr-btc/src/alice.rs b/xmr-btc/src/alice.rs index 72b5996c..50734c69 100644 --- a/xmr-btc/src/alice.rs +++ b/xmr-btc/src/alice.rs @@ -92,13 +92,15 @@ where { #[derive(Debug)] enum SwapFailed { - BeforeBtcLock, + BeforeBtcLock(Reason), AfterXmrLock { tx_lock_height: u32, reason: Reason }, } /// Reason why the swap has failed. #[derive(Debug)] enum Reason { + /// Bob was too slow to lock the bitcoin. + InactiveBob, /// Bob's encrypted signature on the Bitcoin redeem transaction is /// invalid. InvalidEncryptedSignature, @@ -126,7 +128,7 @@ where bitcoin_client.watch_for_raw_transaction(tx_lock.txid()), ) .await - .map_err(|_| SwapFailed::BeforeBtcLock)?; + .map_err(|_| SwapFailed::BeforeBtcLock(Reason::InactiveBob))?; let tx_lock_height = bitcoin_client .transaction_block_height(tx_lock.txid()) diff --git a/xmr-btc/src/bob.rs b/xmr-btc/src/bob.rs index 5b1c1667..8751e9c0 100644 --- a/xmr-btc/src/bob.rs +++ b/xmr-btc/src/bob.rs @@ -97,7 +97,7 @@ where { #[derive(Debug)] enum SwapFailed { - BeforeBtcLock, + BeforeBtcLock(Reason), AfterBtcLock(Reason), AfterBtcRedeem(Reason), } @@ -105,6 +105,8 @@ where /// Reason why the swap has failed. #[derive(Debug)] enum Reason { + /// Bob was too slow to lock the bitcoin. + InactiveBob, /// The refund timelock has been reached. BtcExpired, /// Alice did not lock up enough monero in the shared output. @@ -127,7 +129,7 @@ where ) .await .map(|tx| tx.txid()) - .map_err(|_| SwapFailed::BeforeBtcLock)?; + .map_err(|_| SwapFailed::BeforeBtcLock(Reason::InactiveBob))?; let tx_lock_height = bitcoin_client .transaction_block_height(tx_lock.txid())