lnwallet: update NewLocalForceCloseSummary for local taproot output sweep

This commit is contained in:
Olaoluwa Osuntokun 2023-03-01 21:43:58 -08:00
parent ad5305b99c
commit b72f368673
No known key found for this signature in database
GPG key ID: 3BBD59E99B280306

View file

@ -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