mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-06-20 04:44:10 -04:00
Include Bob being inactive as a reason for failure
This commit is contained in:
parent
41e8c7283c
commit
aa2a20916e
2 changed files with 8 additions and 4 deletions
|
@ -92,13 +92,15 @@ where
|
||||||
{
|
{
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum SwapFailed {
|
enum SwapFailed {
|
||||||
BeforeBtcLock,
|
BeforeBtcLock(Reason),
|
||||||
AfterXmrLock { tx_lock_height: u32, reason: Reason },
|
AfterXmrLock { tx_lock_height: u32, reason: Reason },
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reason why the swap has failed.
|
/// Reason why the swap has failed.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum Reason {
|
enum Reason {
|
||||||
|
/// Bob was too slow to lock the bitcoin.
|
||||||
|
InactiveBob,
|
||||||
/// Bob's encrypted signature on the Bitcoin redeem transaction is
|
/// Bob's encrypted signature on the Bitcoin redeem transaction is
|
||||||
/// invalid.
|
/// invalid.
|
||||||
InvalidEncryptedSignature,
|
InvalidEncryptedSignature,
|
||||||
|
@ -126,7 +128,7 @@ where
|
||||||
bitcoin_client.watch_for_raw_transaction(tx_lock.txid()),
|
bitcoin_client.watch_for_raw_transaction(tx_lock.txid()),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.map_err(|_| SwapFailed::BeforeBtcLock)?;
|
.map_err(|_| SwapFailed::BeforeBtcLock(Reason::InactiveBob))?;
|
||||||
|
|
||||||
let tx_lock_height = bitcoin_client
|
let tx_lock_height = bitcoin_client
|
||||||
.transaction_block_height(tx_lock.txid())
|
.transaction_block_height(tx_lock.txid())
|
||||||
|
|
|
@ -97,7 +97,7 @@ where
|
||||||
{
|
{
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum SwapFailed {
|
enum SwapFailed {
|
||||||
BeforeBtcLock,
|
BeforeBtcLock(Reason),
|
||||||
AfterBtcLock(Reason),
|
AfterBtcLock(Reason),
|
||||||
AfterBtcRedeem(Reason),
|
AfterBtcRedeem(Reason),
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,8 @@ where
|
||||||
/// Reason why the swap has failed.
|
/// Reason why the swap has failed.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum Reason {
|
enum Reason {
|
||||||
|
/// Bob was too slow to lock the bitcoin.
|
||||||
|
InactiveBob,
|
||||||
/// The refund timelock has been reached.
|
/// The refund timelock has been reached.
|
||||||
BtcExpired,
|
BtcExpired,
|
||||||
/// Alice did not lock up enough monero in the shared output.
|
/// Alice did not lock up enough monero in the shared output.
|
||||||
|
@ -127,7 +129,7 @@ where
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.map(|tx| tx.txid())
|
.map(|tx| tx.txid())
|
||||||
.map_err(|_| SwapFailed::BeforeBtcLock)?;
|
.map_err(|_| SwapFailed::BeforeBtcLock(Reason::InactiveBob))?;
|
||||||
|
|
||||||
let tx_lock_height = bitcoin_client
|
let tx_lock_height = bitcoin_client
|
||||||
.transaction_block_height(tx_lock.txid())
|
.transaction_block_height(tx_lock.txid())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue