From 8980471d579b18b1d5096ddde9e70b9c46f68281 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 10 May 2022 18:01:14 +0200 Subject: [PATCH] chanfunding: support p2tr input fee calculation With this commit we support fee calculation in coin selection for p2tr inputs. We assume that coins in our UTXO selection are only BIP0086 coins. Any other input types with different spend paths won't be selected by the wallet assembler. --- lnwallet/chanfunding/coin_select.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lnwallet/chanfunding/coin_select.go b/lnwallet/chanfunding/coin_select.go index 119194c88..761f7c032 100644 --- a/lnwallet/chanfunding/coin_select.go +++ b/lnwallet/chanfunding/coin_select.go @@ -79,6 +79,11 @@ func calculateFees(utxos []Coin, feeRate chainfee.SatPerKWeight) (btcutil.Amount case txscript.IsPayToScriptHash(utxo.PkScript): weightEstimate.AddNestedP2WKHInput() + case txscript.IsPayToTaproot(utxo.PkScript): + weightEstimate.AddTaprootKeySpendInput( + txscript.SigHashDefault, + ) + default: return 0, 0, &errUnsupportedInput{utxo.PkScript} }