Simplify code within BobState::EncSigSent

This commit is contained in:
Thomas Eizinger 2021-03-18 13:42:04 +11:00
parent 09e2d5b5d7
commit c32ef92cf5
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

View File

@ -193,16 +193,11 @@ async fn run_until_internal(
}
BobState::EncSigSent(state) => {
if let ExpiredTimelocks::None = state.expired_timelock(bitcoin_wallet.as_ref()).await? {
let state_clone = state.clone();
let redeem_watcher = state_clone.watch_for_redeem_btc(bitcoin_wallet.as_ref());
let cancel_timelock_expires =
state_clone.wait_for_cancel_timelock_to_expire(bitcoin_wallet.as_ref());
select! {
state5 = redeem_watcher => {
state5 = state.watch_for_redeem_btc(bitcoin_wallet.as_ref()) => {
BobState::BtcRedeemed(state5?)
},
_ = cancel_timelock_expires => {
_ = state.wait_for_cancel_timelock_to_expire(bitcoin_wallet.as_ref()) => {
BobState::CancelTimelockExpired(state)
}
}