From 65a9c1680ec1f0e80a32be9142c2b6d4f1addfc7 Mon Sep 17 00:00:00 2001 From: pokkst Date: Sat, 12 Aug 2023 22:20:54 -0500 Subject: [PATCH] Add edge case bugfix for our databse not updating correctly when Alice redeems her BTC --- swap/src/protocol/bob/swap.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/swap/src/protocol/bob/swap.rs b/swap/src/protocol/bob/swap.rs index 37a6b65a..667dae6e 100644 --- a/swap/src/protocol/bob/swap.rs +++ b/swap/src/protocol/bob/swap.rs @@ -190,6 +190,11 @@ async fn next_state( // Bob sends Alice his key select! { + state5 = state.watch_for_redeem_btc(bitcoin_wallet) => { + // there seems to be a weird edge case where you can send the encrypted signature, alice can redeem the btc, but your database doesn't update to encsigsent or btcredeemed, so here we will watch for redemption too, so we have a chance to unlock xmr. + // this seemed to have happened when a surge of blocks came in on stagenet within a short time frame + BobState::BtcRedeemed(state5?) + }, result = event_loop_handle.send_encrypted_signature(state.tx_redeem_encsig()) => { match result { Ok(_) => BobState::EncSigSent(state),