From 18faa786d6e7fe85e33c97682454327964ec9acc Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Mon, 30 Aug 2021 12:07:01 +1000 Subject: [PATCH] Fail if something goes wrong when checking tx lock status Probably a failure when interacting with the electrum node to get script status updates --- CHANGELOG.md | 3 +++ swap/src/protocol/alice/swap.rs | 3 ++- swap/src/protocol/bob/swap.rs | 11 +++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8992f81c..b96e9cfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - An issue where the ASB was unable to use the Monero wallet in case `monero-wallet-rpc` has been restarted. In case no wallet is loaded when we try to interact with the `monero-wallet-rpc` daemon, we now load the correct wallet on-demand. See issue https://github.com/comit-network/xmr-btc-swap/issues/652. +- An issue where swap protocol was getting stuck trying to submit the cancel transaction. + We were not handling the error when TxCancel submission fails. + See issues: https://github.com/comit-network/xmr-btc-swap/issues/709, https://github.com/comit-network/xmr-btc-swap/issues/688, https://github.com/comit-network/xmr-btc-swap/issues/701. ## [0.8.1] - 2021-08-16 diff --git a/swap/src/protocol/alice/swap.rs b/swap/src/protocol/alice/swap.rs index b09658f0..c3808103 100644 --- a/swap/src/protocol/alice/swap.rs +++ b/swap/src/protocol/alice/swap.rs @@ -195,7 +195,8 @@ where select! { biased; // make sure the cancel timelock expiry future is polled first - _ = tx_lock_status.wait_until_confirmed_with(state3.cancel_timelock) => { + result = tx_lock_status.wait_until_confirmed_with(state3.cancel_timelock) => { + let _ = result?; AliceState::CancelTimelockExpired { monero_wallet_restore_blockheight, transfer_proof, diff --git a/swap/src/protocol/bob/swap.rs b/swap/src/protocol/bob/swap.rs index 0ebab92b..c1987e20 100644 --- a/swap/src/protocol/bob/swap.rs +++ b/swap/src/protocol/bob/swap.rs @@ -128,7 +128,7 @@ async fn next_state( let state4 = state3.cancel(); BobState::CancelTimelockExpired(state4) - } + }, } } else { let state4 = state3.cancel(); @@ -159,7 +159,8 @@ async fn next_state( }, } } - _ = tx_lock_status.wait_until_confirmed_with(state.cancel_timelock) => { + result = tx_lock_status.wait_until_confirmed_with(state.cancel_timelock) => { + let _ = result?; BobState::CancelTimelockExpired(state.cancel()) } } @@ -178,7 +179,8 @@ async fn next_state( _ = event_loop_handle.send_encrypted_signature(state.tx_redeem_encsig()) => { BobState::EncSigSent(state) }, - _ = tx_lock_status.wait_until_confirmed_with(state.cancel_timelock) => { + result = tx_lock_status.wait_until_confirmed_with(state.cancel_timelock) => { + let _ = result?; BobState::CancelTimelockExpired(state.cancel()) } } @@ -194,7 +196,8 @@ async fn next_state( state5 = state.watch_for_redeem_btc(bitcoin_wallet) => { BobState::BtcRedeemed(state5?) }, - _ = tx_lock_status.wait_until_confirmed_with(state.cancel_timelock) => { + result = tx_lock_status.wait_until_confirmed_with(state.cancel_timelock) => { + let _ = result?; BobState::CancelTimelockExpired(state.cancel()) } }