From 09e2d5b5d798f820fd0ead62b3cd3636009abffa Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Thu, 18 Mar 2021 13:34:46 +1100 Subject: [PATCH] Simplify code within BobState::XmrLocked By reducing the number of local variables, we can greatly simplify this piece of code. --- swap/src/protocol/bob/swap.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/swap/src/protocol/bob/swap.rs b/swap/src/protocol/bob/swap.rs index 0a7dabe6..20b059ef 100644 --- a/swap/src/protocol/bob/swap.rs +++ b/swap/src/protocol/bob/swap.rs @@ -178,21 +178,12 @@ async fn run_until_internal( event_loop_handle.dial().await?; // Alice has locked Xmr // Bob sends Alice his key - let tx_redeem_encsig = state.tx_redeem_encsig(); - - let state4_clone = state.clone(); - - let enc_sig_sent_watcher = - event_loop_handle.send_encrypted_signature(tx_redeem_encsig); - let bitcoin_wallet = bitcoin_wallet.clone(); - let cancel_timelock_expires = - state4_clone.wait_for_cancel_timelock_to_expire(bitcoin_wallet.as_ref()); select! { - _ = enc_sig_sent_watcher => { + _ = event_loop_handle.send_encrypted_signature(state.tx_redeem_encsig()) => { BobState::EncSigSent(state) }, - _ = cancel_timelock_expires => { + _ = state.wait_for_cancel_timelock_to_expire(bitcoin_wallet.as_ref()) => { BobState::CancelTimelockExpired(state) } }