From b72f368673942333b810439357f6ddaca559c1b3 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 1 Mar 2023 21:43:58 -0800 Subject: [PATCH] lnwallet: update NewLocalForceCloseSummary for local taproot output sweep --- lnwallet/channel.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 41c468991..6f5fd9fc3 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -7240,6 +7240,24 @@ func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel, }, MaturityDelay: csvTimeout, } + + // For taproot channels, we'll need to set some additional + // fields to ensure the output can be swept. + // + // TODO(roasbef): abstract into new func + if chanState.ChanType.IsTaproot() { + commitResolution.SelfOutputSignDesc.SignMethod = + input.TaprootScriptSpendSignMethod + + ctrlBlock := input.MakeTaprootCtrlBlock( + commitResolution.SelfOutputSignDesc.WitnessScript, + keyRing.RevocationKey, toLocalScript.ScriptTree, + ) + commitResolution.SelfOutputSignDesc.ControlBlock, err = ctrlBlock.ToBytes() + if err != nil { + return nil, err + } + } } // Once the delay output has been found (if it exists), then we'll also