mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Remove timeout on send encrypted signature
Bob was timing out if the encrypted signature could not be sent in 60 seconds. This behaviour is unnecessary because we are racing against the cancel timelock anyway. By timing out before this, we remove the opportunity for bob and alice to re-establish a connection.
This commit is contained in:
parent
8598bcade1
commit
af50c655ae
@ -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<EncryptedSignature>> {
|
||||
Ok(self
|
||||
.encrypted_signature
|
||||
.send_receive(tx_redeem_encsig)
|
||||
|
@ -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?;
|
||||
|
Loading…
Reference in New Issue
Block a user