From 5a2f82478a47aaf9abb8b2844ee267d724fcef51 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Thu, 4 Feb 2021 17:13:03 +1100 Subject: [PATCH] Preemptively box cancel tx to avoid size difference in enum --- swap/src/database/alice.rs | 2 +- swap/src/protocol/alice/state.rs | 2 +- swap/src/protocol/alice/swap.rs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/swap/src/database/alice.rs b/swap/src/database/alice.rs index 42c7a2b3..9a9c4383 100644 --- a/swap/src/database/alice.rs +++ b/swap/src/database/alice.rs @@ -150,7 +150,7 @@ impl From for AliceState { AliceState::BtcCancelled { state3: Box::new(state), - tx_cancel, + tx_cancel: Box::new(tx_cancel), } } Alice::BtcPunishable(state3) => { diff --git a/swap/src/protocol/alice/state.rs b/swap/src/protocol/alice/state.rs index f6e45f9e..96f12cfa 100644 --- a/swap/src/protocol/alice/state.rs +++ b/swap/src/protocol/alice/state.rs @@ -46,7 +46,7 @@ pub enum AliceState { }, BtcRedeemed, BtcCancelled { - tx_cancel: TxCancel, + tx_cancel: Box, state3: Box, }, BtcRefunded { diff --git a/swap/src/protocol/alice/swap.rs b/swap/src/protocol/alice/swap.rs index ee97954f..1a7268f3 100644 --- a/swap/src/protocol/alice/swap.rs +++ b/swap/src/protocol/alice/swap.rs @@ -304,7 +304,10 @@ async fn run_until_internal( ) .await?; - let state = AliceState::BtcCancelled { state3, tx_cancel }; + let state = AliceState::BtcCancelled { + state3, + tx_cancel: Box::new(tx_cancel), + }; let db_state = (&state).into(); db.insert_latest_state(swap_id, database::Swap::Alice(db_state)) .await?;