From fab4be45b557c76f4adbc4d9e746e712afb3f76a Mon Sep 17 00:00:00 2001 From: ok300 <106775972+ok300@users.noreply.github.com> Date: Thu, 16 May 2024 14:47:56 +0200 Subject: [PATCH] Use hardcoded random P2TR addresses to estimate fees Use P2TR address as destination when estimating fees --- lib/core/src/sdk.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/core/src/sdk.rs b/lib/core/src/sdk.rs index b5e6ce0..720b772 100644 --- a/lib/core/src/sdk.rs +++ b/lib/core/src/sdk.rs @@ -397,8 +397,16 @@ impl LiquidSdk { } fn get_broadcast_fee_estimation(&self, amount_sat: u64) -> Result { + // 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())