Merge pull request #190 from breez/ok300-yse-fix-fee-estimation

Use P2TR address as destination when estimating fees
This commit is contained in:
ok300
2024-05-16 21:05:37 +00:00
committed by GitHub

View File

@@ -397,8 +397,16 @@ impl LiquidSdk {
}
fn get_broadcast_fee_estimation(&self, amount_sat: u64) -> Result<u64> {
// TODO Replace this with own address when LWK supports taproot
// https://github.com/Blockstream/lwk/issues/31
let temp_p2tr_addr = match self.network {
Network::Liquid => "lq1pqvzxvqhrf54dd4sny4cag7497pe38252qefk46t92frs7us8r80ja9ha8r5me09nn22m4tmdqp5p4wafq3s59cql3v9n45t5trwtxrmxfsyxjnstkctj",
Network::LiquidTestnet => "tlq1pq0wqu32e2xacxeyps22x8gjre4qk3u6r70pj4r62hzczxeyz8x3yxucrpn79zy28plc4x37aaf33kwt6dz2nn6gtkya6h02mwpzy4eh69zzexq7cf5y5"
};
// Create a throw-away tx similar to the lockup tx, in order to estimate fees
Ok(self
.build_tx(None, &self.address()?.to_string(), amount_sat)?
.build_tx(None, temp_p2tr_addr, amount_sat)?
.all_fees()
.values()
.sum())