Preemptively box encrypted signature to avoid size difference in enum

This commit is contained in:
Franck Royer 2021-02-04 17:10:18 +11:00
parent fd084b764d
commit 69363e43a3
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
3 changed files with 5 additions and 5 deletions

View File

@ -76,7 +76,7 @@ impl From<&AliceState> for Alice {
encrypted_signature, encrypted_signature,
} => Alice::EncSigLearned { } => Alice::EncSigLearned {
state3: state3.as_ref().clone(), state3: state3.as_ref().clone(),
encrypted_signature: encrypted_signature.clone(), encrypted_signature: *encrypted_signature.clone(),
}, },
AliceState::BtcRedeemed => Alice::Done(AliceEndState::BtcRedeemed), AliceState::BtcRedeemed => Alice::Done(AliceEndState::BtcRedeemed),
AliceState::BtcCancelled { state3, .. } => Alice::BtcCancelled(state3.as_ref().clone()), AliceState::BtcCancelled { state3, .. } => Alice::BtcCancelled(state3.as_ref().clone()),
@ -135,7 +135,7 @@ impl From<Alice> for AliceState {
encrypted_signature, encrypted_signature,
} => AliceState::EncSigLearned { } => AliceState::EncSigLearned {
state3: Box::new(state), state3: Box::new(state),
encrypted_signature, encrypted_signature: Box::new(encrypted_signature),
}, },
Alice::CancelTimelockExpired(state3) => AliceState::CancelTimelockExpired { Alice::CancelTimelockExpired(state3) => AliceState::CancelTimelockExpired {
state3: Box::new(state3), state3: Box::new(state3),

View File

@ -41,7 +41,7 @@ pub enum AliceState {
state3: Box<State3>, state3: Box<State3>,
}, },
EncSigLearned { EncSigLearned {
encrypted_signature: bitcoin::EncryptedSignature, encrypted_signature: Box<bitcoin::EncryptedSignature>,
state3: Box<State3>, state3: Box<State3>,
}, },
BtcRedeemed, BtcRedeemed,

View File

@ -202,7 +202,7 @@ async fn run_until_internal(
Either::Left(_) => AliceState::CancelTimelockExpired { state3 }, Either::Left(_) => AliceState::CancelTimelockExpired { state3 },
Either::Right((enc_sig, _)) => AliceState::EncSigLearned { Either::Right((enc_sig, _)) => AliceState::EncSigLearned {
state3, 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? { let state = match state3.expired_timelocks(bitcoin_wallet.as_ref()).await? {
ExpiredTimelocks::None => { ExpiredTimelocks::None => {
match build_bitcoin_redeem_transaction( match build_bitcoin_redeem_transaction(
encrypted_signature, *encrypted_signature,
&state3.tx_lock, &state3.tx_lock,
state3.a.clone(), state3.a.clone(),
state3.s_a, state3.s_a,