Skip to content

Commit

Permalink
Handle errors when waiting for subscriptions
Browse files Browse the repository at this point in the history
We were not thorough enough in PR #705 and there were some remaining
unhandled errors.
  • Loading branch information
rishflab committed Sep 2, 2021
1 parent 699b16b commit bd4ebad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 cannot submit the cancel transaction due to a bitcoin transaction monitoring error.
This could lead to a scenario where the CLI is unable to cancel and refund if the ASB does not respond in time with a transfer proof resulting in BTC being locked up forever.

## [0.8.2] - 2021-09-01

### Added
Expand Down
7 changes: 5 additions & 2 deletions swap/src/protocol/alice/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion swap/src/protocol/bob/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit bd4ebad

Please sign in to comment.