From b98445f9a83ab6ac4cd7bde867ec6f18d553c5ee Mon Sep 17 00:00:00 2001 From: binarybaron <86064887+binarybaron@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:45:27 +0200 Subject: [PATCH] Update cancel_and_refund.rs --- swap/src/cli/cancel_and_refund.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/swap/src/cli/cancel_and_refund.rs b/swap/src/cli/cancel_and_refund.rs index 67e95b28..2d23c29a 100644 --- a/swap/src/cli/cancel_and_refund.rs +++ b/swap/src/cli/cancel_and_refund.rs @@ -78,6 +78,7 @@ pub async fn cancel( // The cancel transaction has not been published yet and we failed to publish it ourselves // Here we try to figure out why match state6.expired_timelock(bitcoin_wallet.as_ref()).await { + // We cannot cancel because Alice has already cancelled and punished afterwards Ok(ExpiredTimelocks::Punish { .. }) => { let state = BobState::BtcPunished { tx_lock_id: state6.tx_lock_id(), @@ -87,6 +88,7 @@ pub async fn cancel( bail!(err.context("Cannot cancel swap because we have already been punished")); } + // We cannot cancel because the cancel timelock has not expired yet Ok(ExpiredTimelocks::None { .. }) => { bail!(err.context( "Cannot cancel swap because the cancel timelock has not expired yet" @@ -96,7 +98,9 @@ pub async fn cancel( bail!(err.context("Failed to cancel swap even though cancel timelock has expired. This is unexpected.")); } Err(timelock_err) => { - bail!(err.context(format!("Failed to check timelock status: {}", timelock_err))) + bail!(err + .context(timelock_err) + .context("Failed to cancel swap and could not check timelock status")); } } }