Add edge case bugfix for our databse not updating correctly when Alice redeems her BTC

This commit is contained in:
pokkst 2023-08-12 22:20:54 -05:00 committed by binarybaron
parent 1930540c1f
commit 65a9c1680e

View File

@ -190,6 +190,11 @@ async fn next_state(
// Bob sends Alice his key // Bob sends Alice his key
select! { 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()) => { result = event_loop_handle.send_encrypted_signature(state.tx_redeem_encsig()) => {
match result { match result {
Ok(_) => BobState::EncSigSent(state), Ok(_) => BobState::EncSigSent(state),