724: Handle errors when waiting for subscriptions r=rishflab a=rishflab

We were not thorough enough in PR #705 and there were some remaining
unhandled errors.

Co-authored-by: rishflab <rishflab@hotmail.com>
This commit is contained in:
bors[bot] 2021-09-02 05:07:59 +00:00 committed by GitHub
commit 1f371ecfee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- A bug where the ASB erroneously transitioned into a punishable state upon a bitcoin transaction monitoring error.
This could lead to a scenario where the ASB was neither able to punish, nor able to refund, so the XMR could stay locked up forever while the CLI refunded the BTC.
- A bug where the CLI erroneously transitioned into a cancel-timelock-expired state upon a bitcoin transaction monitoring error.
This could lead to a scenario where the CLI is forced to wait for cancel, even though the cancel timelock is not yet expired and the swap could still be redeemed.
## [0.8.2] - 2021-09-01
### Added

View File

@ -176,7 +176,8 @@ where
state3,
}
},
_ = 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,
@ -325,7 +326,9 @@ where
state3,
}
}
_ = tx_cancel_status.wait_until_confirmed_with(state3.punish_timelock) => {
result = tx_cancel_status.wait_until_confirmed_with(state3.punish_timelock) => {
let _ = result?;
AliceState::BtcPunishable {
monero_wallet_restore_blockheight,
transfer_proof,

View File

@ -123,7 +123,8 @@ async fn next_state(
monero_wallet_restore_blockheight
}
},
_ = cancel_timelock_expires => {
result = cancel_timelock_expires => {
let _ = result?;
tracing::info!("Alice took too long to lock Monero, cancelling the swap");
let state4 = state3.cancel();