fix: explicitly set absolute fees when signing transactions (#682)

Reflect changes from SatoshiPortal/boltz-client@db045fbd94
This commit is contained in:
yse
2025-01-27 19:27:45 +01:00
committed by GitHub
parent 2f3326d7b2
commit cf957a4d98
6 changed files with 20 additions and 11 deletions

2
cli/Cargo.lock generated
View File

@@ -707,7 +707,7 @@ dependencies = [
[[package]]
name = "boltz-client"
version = "0.2.0"
source = "git+https://github.com/danielgranhao/boltz-rust?rev=e3e87186604c818c667b1293149423af5757dfbe#e3e87186604c818c667b1293149423af5757dfbe"
source = "git+https://github.com/hydra-yse/boltz-rust?rev=5c2a7aebd1669d599d76e782952b876a901bfb05#5c2a7aebd1669d599d76e782952b876a901bfb05"
dependencies = [
"bip39",
"bitcoin 0.32.5",

2
lib/Cargo.lock generated
View File

@@ -802,7 +802,7 @@ dependencies = [
[[package]]
name = "boltz-client"
version = "0.2.0"
source = "git+https://github.com/danielgranhao/boltz-rust?rev=e3e87186604c818c667b1293149423af5757dfbe#e3e87186604c818c667b1293149423af5757dfbe"
source = "git+https://github.com/hydra-yse/boltz-rust?rev=5c2a7aebd1669d599d76e782952b876a901bfb05#5c2a7aebd1669d599d76e782952b876a901bfb05"
dependencies = [
"bip39",
"bitcoin 0.32.4",

View File

@@ -17,7 +17,7 @@ workspace = true
[dependencies]
anyhow = { workspace = true }
bip39 = "2.0.0"
boltz-client = { git = "https://github.com/danielgranhao/boltz-rust", rev = "e3e87186604c818c667b1293149423af5757dfbe" }
boltz-client = { git = "https://github.com/hydra-yse/boltz-rust", rev = "5c2a7aebd1669d599d76e782952b876a901bfb05" }
chrono = "0.4"
derivative = "2.2.0"
env_logger = "0.11"

View File

@@ -393,7 +393,7 @@ impl SendSwapHandler {
ensure_sdk!(
history.len() <= 2,
PaymentError::Generic {
err: "Lockup address history for Send Swap {id} has more than 2 txs".to_string()
err: format!("Lockup address history for Send Swap {id} has more than 2 txs")
}
);
@@ -557,7 +557,7 @@ impl SendSwapHandler {
match (from_state, to_state) {
(TimedOut, Created) => Ok(()),
(_, Created) => Err(PaymentError::Generic {
err: "Cannot transition from {from_state:?} to Created state".to_string(),
err: format!("Cannot transition from {from_state:?} to Created state"),
}),
(Created | Pending, Pending) => Ok(()),

View File

@@ -3,6 +3,7 @@ use std::str::FromStr;
use boltz_client::{
bitcoin::{address::Address, Transaction},
boltz::SwapTxKind,
fees::Fee,
util::secrets::Preimage,
BtcSwapTx,
};
@@ -94,7 +95,11 @@ impl BoltzSwapper {
false => None,
};
let signed_tx = refund_tx.sign_refund(&refund_keypair, broadcast_fees_sat, cooperative)?;
let signed_tx = refund_tx.sign_refund(
&refund_keypair,
Fee::Absolute(broadcast_fees_sat),
cooperative,
)?;
Ok(signed_tx)
}
@@ -118,7 +123,7 @@ impl BoltzSwapper {
let signed_tx = claim_tx_wrapper.sign_claim(
&claim_keypair,
&Preimage::from_str(&swap.preimage)?,
swap.claim_fees_sat,
Fee::Absolute(swap.claim_fees_sat),
self.get_cooperative_details(swap.id.clone(), Some(pub_nonce), Some(partial_sig)),
)?;

View File

@@ -3,8 +3,9 @@ use std::str::FromStr;
use boltz_client::{
boltz::SwapTxKind,
elements::Transaction,
fees::Fee,
util::{liquid_genesis_hash, secrets::Preimage},
Amount, ElementsAddress as Address, LBtcSwapTx,
ElementsAddress as Address, LBtcSwapTx,
};
use log::info;
@@ -47,8 +48,9 @@ impl BoltzSwapper {
let signed_tx = claim_tx_wrapper.sign_claim(
&swap.get_claim_keypair()?,
&Preimage::from_str(&swap.preimage)?,
Amount::from_sat(swap.claim_fees_sat),
Fee::Absolute(swap.claim_fees_sat),
self.get_cooperative_details(swap.id.clone(), None, None),
true,
)?;
Ok(signed_tx)
@@ -74,8 +76,9 @@ impl BoltzSwapper {
let signed_tx = claim_tx_wrapper.sign_claim(
&claim_keypair,
&Preimage::from_str(&swap.preimage)?,
Amount::from_sat(swap.claim_fees_sat),
Fee::Absolute(swap.claim_fees_sat),
self.get_cooperative_details(swap.id.clone(), Some(pub_nonce), Some(partial_sig)),
true,
)?;
Ok(signed_tx)
@@ -192,8 +195,9 @@ impl BoltzSwapper {
let signed_tx = refund_tx.sign_refund(
&refund_keypair,
Amount::from_sat(broadcast_fees_sat),
Fee::Absolute(broadcast_fees_sat),
cooperative,
true,
)?;
Ok(signed_tx)
}