diff --git a/swap/src/cli/event_loop.rs b/swap/src/cli/event_loop.rs index 2ed37b26..d8c0d453 100644 --- a/swap/src/cli/event_loop.rs +++ b/swap/src/cli/event_loop.rs @@ -54,7 +54,7 @@ impl EventLoop { ) -> Result<(Self, EventLoopHandle)> { let execution_setup = bmrng::channel_with_timeout(1, Duration::from_secs(60)); let transfer_proof = bmrng::channel_with_timeout(1, Duration::from_secs(60)); - let encrypted_signature = bmrng::channel_with_timeout(1, Duration::from_secs(60)); + let encrypted_signature = bmrng::channel(1); let quote = bmrng::channel_with_timeout(1, Duration::from_secs(60)); let event_loop = EventLoop { @@ -248,7 +248,7 @@ impl EventLoopHandle { pub async fn send_encrypted_signature( &mut self, tx_redeem_encsig: EncryptedSignature, - ) -> Result<()> { + ) -> Result<(), bmrng::error::RequestError> { Ok(self .encrypted_signature .send_receive(tx_redeem_encsig) diff --git a/swap/src/protocol/bob/swap.rs b/swap/src/protocol/bob/swap.rs index c1987e20..45c5a3b1 100644 --- a/swap/src/protocol/bob/swap.rs +++ b/swap/src/protocol/bob/swap.rs @@ -176,8 +176,12 @@ async fn next_state( // Bob sends Alice his key select! { - _ = event_loop_handle.send_encrypted_signature(state.tx_redeem_encsig()) => { - BobState::EncSigSent(state) + result = event_loop_handle.send_encrypted_signature(state.tx_redeem_encsig()) => { + match result { + Ok(_) => BobState::EncSigSent(state), + Err(bmrng::error::RequestError::RecvError | bmrng::error::RequestError::SendError(_)) => bail!("Failed to communicate encrypted signature through event loop channel"), + Err(bmrng::error::RequestError::RecvTimeoutError) => unreachable!("We construct the channel with no timeout"), + } }, result = tx_lock_status.wait_until_confirmed_with(state.cancel_timelock) => { let _ = result?;