diff --git a/lib/core/src/persist/chain.rs b/lib/core/src/persist/chain.rs index e1782f9c8..16eb7307d 100644 --- a/lib/core/src/persist/chain.rs +++ b/lib/core/src/persist/chain.rs @@ -36,10 +36,9 @@ impl Persister { refund_private_key, claim_fees_sat, created_at, - state, - pair_fees_json + state ) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", ( &chain_swap.id, &id_hash, @@ -57,7 +56,6 @@ impl Persister { &chain_swap.claim_fees_sat, &chain_swap.created_at, &chain_swap.state, - &chain_swap.pair_fees_json, ), )?; @@ -68,7 +66,8 @@ impl Persister { server_lockup_tx_id = :server_lockup_tx_id, user_lockup_tx_id = :user_lockup_tx_id, claim_tx_id = :claim_tx_id, - refund_tx_id = :refund_tx_id + refund_tx_id = :refund_tx_id, + pair_fees_json = :pair_fees_json WHERE id = :id", named_params! { @@ -78,6 +77,7 @@ impl Persister { ":user_lockup_tx_id": &chain_swap.user_lockup_tx_id, ":claim_tx_id": &chain_swap.claim_tx_id, ":refund_tx_id": &chain_swap.refund_tx_id, + ":pair_fees_json": &chain_swap.pair_fees_json, }, )?; diff --git a/lib/core/src/persist/send.rs b/lib/core/src/persist/send.rs index 9614202c1..2fe259fd0 100644 --- a/lib/core/src/persist/send.rs +++ b/lib/core/src/persist/send.rs @@ -36,7 +36,7 @@ impl Persister { state, pair_fees_json ) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", ( &send_swap.id, &id_hash, diff --git a/lib/core/src/sync/model/data.rs b/lib/core/src/sync/model/data.rs index c88a4d86d..3878d4575 100644 --- a/lib/core/src/sync/model/data.rs +++ b/lib/core/src/sync/model/data.rs @@ -8,6 +8,7 @@ pub(crate) const LAST_DERIVATION_INDEX_DATA_ID: &str = "last-derivation-index"; pub(crate) struct ChainSyncData { pub(crate) swap_id: String, pub(crate) preimage: String, + pub(crate) pair_fees_json: String, pub(crate) create_response_json: String, pub(crate) direction: Direction, pub(crate) lockup_address: String, @@ -38,6 +39,7 @@ impl From for ChainSyncData { Self { swap_id: value.id, preimage: value.preimage, + pair_fees_json: value.pair_fees_json, create_response_json: value.create_response_json, direction: value.direction, lockup_address: value.lockup_address, @@ -67,6 +69,7 @@ impl From for ChainSwap { receiver_amount_sat: val.receiver_amount_sat, claim_fees_sat: val.claim_fees_sat, accept_zero_conf: val.accept_zero_conf, + pair_fees_json: val.pair_fees_json, create_response_json: val.create_response_json, created_at: val.created_at, claim_private_key: val.claim_private_key, @@ -85,6 +88,7 @@ impl From for ChainSwap { pub(crate) struct SendSyncData { pub(crate) swap_id: String, pub(crate) invoice: String, + pub(crate) pair_fees_json: String, pub(crate) create_response_json: String, pub(crate) refund_private_key: String, pub(crate) payer_amount_sat: u64, @@ -113,6 +117,7 @@ impl From for SendSyncData { swap_id: value.id, payment_hash: value.payment_hash, invoice: value.invoice, + pair_fees_json: value.pair_fees_json, create_response_json: value.create_response_json, refund_private_key: value.refund_private_key, payer_amount_sat: value.payer_amount_sat, @@ -135,6 +140,7 @@ impl From for SendSwap { preimage: val.preimage, payer_amount_sat: val.payer_amount_sat, receiver_amount_sat: val.receiver_amount_sat, + pair_fees_json: val.pair_fees_json, create_response_json: val.create_response_json, created_at: val.created_at, refund_private_key: val.refund_private_key, @@ -151,6 +157,7 @@ pub(crate) struct ReceiveSyncData { pub(crate) swap_id: String, pub(crate) invoice: String, pub(crate) preimage: String, + pub(crate) pair_fees_json: String, pub(crate) create_response_json: String, pub(crate) claim_fees_sat: u64, pub(crate) claim_private_key: String, @@ -169,6 +176,7 @@ impl From for ReceiveSyncData { payment_hash: value.payment_hash, invoice: value.invoice, preimage: value.preimage, + pair_fees_json: value.pair_fees_json, create_response_json: value.create_response_json, claim_fees_sat: value.claim_fees_sat, claim_private_key: value.claim_private_key, @@ -187,6 +195,7 @@ impl From for ReceiveSwap { id: val.swap_id, preimage: val.preimage, create_response_json: val.create_response_json, + pair_fees_json: val.pair_fees_json, claim_private_key: val.claim_private_key, invoice: val.invoice, payment_hash: val.payment_hash, diff --git a/lib/core/src/test_utils/swapper.rs b/lib/core/src/test_utils/swapper.rs index 68c35517c..322568dc7 100644 --- a/lib/core/src/test_utils/swapper.rs +++ b/lib/core/src/test_utils/swapper.rs @@ -314,7 +314,7 @@ impl Swapper for MockSwapper { unimplemented!() } - fn get_zero_amount_chain_swap_quote(&self, swap_id: &str) -> Result { + fn get_zero_amount_chain_swap_quote(&self, _swap_id: &str) -> Result { unimplemented!() } diff --git a/lib/core/src/test_utils/sync.rs b/lib/core/src/test_utils/sync.rs index 213e99fdb..a4ab84e3a 100644 --- a/lib/core/src/test_utils/sync.rs +++ b/lib/core/src/test_utils/sync.rs @@ -116,6 +116,7 @@ pub(crate) fn new_receive_sync_data() -> ReceiveSyncData { ReceiveSyncData { swap_id: "receive-swap".to_string(), invoice: "".to_string(), + pair_fees_json: "".to_string(), create_response_json: "".to_string(), payer_amount_sat: 0, receiver_amount_sat: 0, @@ -133,6 +134,7 @@ pub(crate) fn new_send_sync_data(preimage: Option) -> SendSyncData { SendSyncData { swap_id: "send-swap".to_string(), invoice: "".to_string(), + pair_fees_json: "".to_string(), create_response_json: "".to_string(), refund_private_key: "".to_string(), payer_amount_sat: 0, @@ -149,6 +151,7 @@ pub(crate) fn new_chain_sync_data(accept_zero_conf: Option) -> ChainSyncDa ChainSyncData { swap_id: "chain-swap".to_string(), preimage: "".to_string(), + pair_fees_json: "".to_string(), create_response_json: "".to_string(), direction: Direction::Incoming, lockup_address: "".to_string(),