From 69363e43a3f8e9719ad784feda37b6eca2199d61 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Thu, 4 Feb 2021 17:10:18 +1100 Subject: [PATCH] Preemptively box encrypted signature to avoid size difference in enum --- swap/src/database/alice.rs | 4 ++-- swap/src/protocol/alice/state.rs | 2 +- swap/src/protocol/alice/swap.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/swap/src/database/alice.rs b/swap/src/database/alice.rs index 07e76501..42c7a2b3 100644 --- a/swap/src/database/alice.rs +++ b/swap/src/database/alice.rs @@ -76,7 +76,7 @@ impl From<&AliceState> for Alice { encrypted_signature, } => Alice::EncSigLearned { state3: state3.as_ref().clone(), - encrypted_signature: encrypted_signature.clone(), + encrypted_signature: *encrypted_signature.clone(), }, AliceState::BtcRedeemed => Alice::Done(AliceEndState::BtcRedeemed), AliceState::BtcCancelled { state3, .. } => Alice::BtcCancelled(state3.as_ref().clone()), @@ -135,7 +135,7 @@ impl From for AliceState { encrypted_signature, } => AliceState::EncSigLearned { state3: Box::new(state), - encrypted_signature, + encrypted_signature: Box::new(encrypted_signature), }, Alice::CancelTimelockExpired(state3) => AliceState::CancelTimelockExpired { state3: Box::new(state3), diff --git a/swap/src/protocol/alice/state.rs b/swap/src/protocol/alice/state.rs index 2e8b4dd5..b1bc2f65 100644 --- a/swap/src/protocol/alice/state.rs +++ b/swap/src/protocol/alice/state.rs @@ -41,7 +41,7 @@ pub enum AliceState { state3: Box, }, EncSigLearned { - encrypted_signature: bitcoin::EncryptedSignature, + encrypted_signature: Box, state3: Box, }, BtcRedeemed, diff --git a/swap/src/protocol/alice/swap.rs b/swap/src/protocol/alice/swap.rs index 97a542de..7edc91ea 100644 --- a/swap/src/protocol/alice/swap.rs +++ b/swap/src/protocol/alice/swap.rs @@ -202,7 +202,7 @@ async fn run_until_internal( Either::Left(_) => AliceState::CancelTimelockExpired { state3 }, Either::Right((enc_sig, _)) => AliceState::EncSigLearned { state3, - encrypted_signature: enc_sig?, + encrypted_signature: Box::new(enc_sig?), }, } } @@ -231,7 +231,7 @@ async fn run_until_internal( let state = match state3.expired_timelocks(bitcoin_wallet.as_ref()).await? { ExpiredTimelocks::None => { match build_bitcoin_redeem_transaction( - encrypted_signature, + *encrypted_signature, &state3.tx_lock, state3.a.clone(), state3.s_a,