mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-01-11 15:39:37 -05:00
Include Bob being inactive as a reason for failure
This commit is contained in:
parent
41e8c7283c
commit
aa2a20916e
@ -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())
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user