mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-11-17 15:26:14 +00:00
Simplify code within BobState::XmrLocked
By reducing the number of local variables, we can greatly simplify this piece of code.
This commit is contained in:
parent
776a50137d
commit
09e2d5b5d7
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user