From ebc61818a3e999eb15b8e36a3f88b0a18f2c33a7 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 1 Mar 2023 21:30:57 -0800 Subject: [PATCH] lnwallet: update CommitWeight to return taproot commit weight --- lnwallet/commitment.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lnwallet/commitment.go b/lnwallet/commitment.go index b9659d916..bd698b5e9 100644 --- a/lnwallet/commitment.go +++ b/lnwallet/commitment.go @@ -464,12 +464,17 @@ func SecondLevelHtlcScript(chanType channeldb.ChannelType, initiator bool, // CommitWeight returns the base commitment weight before adding HTLCs. func CommitWeight(chanType channeldb.ChannelType) int64 { - // If this commitment has anchors, it will be slightly heavier. - if chanType.HasAnchors() { - return input.AnchorCommitWeight - } + switch { + case chanType.IsTaproot(): + return input.TaprootCommitWeight - return input.CommitWeight + // If this commitment has anchors, it will be slightly heavier. + case chanType.HasAnchors(): + return input.AnchorCommitWeight + + default: + return input.CommitWeight + } } // HtlcTimeoutFee returns the fee in satoshis required for an HTLC timeout