lnwallet: NewUnilateralCloseSummary for local taproot output sweep

This commit is contained in:
Olaoluwa Osuntokun 2023-03-01 21:44:14 -08:00
parent b72f368673
commit 52b122a8bb
No known key found for this signature in database
GPG Key ID: 3BBD59E99B280306

View File

@ -6372,6 +6372,26 @@ func NewUnilateralCloseSummary(chanState *channeldb.OpenChannel, signer input.Si
},
MaturityDelay: maturityDelay,
}
// 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,
&input.TaprootNUMSKey, selfScript.ScriptTree,
)
commitResolution.SelfOutputSignDesc.ControlBlock, err = ctrlBlock.ToBytes()
if err != nil {
return nil, err
}
// TODO(roasbeef): put ctrl block in resolution?
}
}
closeSummary := channeldb.ChannelCloseSummary{