Merge pull request #9072 from lightningnetwork/extract-part3-from-staging-branch

[custom channels 3/5]: Extract PART3 from mega staging branch
This commit is contained in:
Oliver Gugger
2024-09-19 01:20:55 -06:00
committed by GitHub
40 changed files with 1926 additions and 162 deletions

View File

@ -1093,8 +1093,8 @@ func (b *Builder) addZombieEdge(chanID uint64) error {
// segwit v1 (taproot) channels.
//
// TODO(roasbeef: export and use elsewhere?
func makeFundingScript(bitcoinKey1, bitcoinKey2 []byte,
chanFeatures []byte) ([]byte, error) {
func makeFundingScript(bitcoinKey1, bitcoinKey2 []byte, chanFeatures []byte,
tapscriptRoot fn.Option[chainhash.Hash]) ([]byte, error) {
legacyFundingScript := func() ([]byte, error) {
witnessScript, err := input.GenMultiSigScript(
@ -1141,7 +1141,7 @@ func makeFundingScript(bitcoinKey1, bitcoinKey2 []byte,
}
fundingScript, _, err := input.GenTaprootFundingScript(
pubKey1, pubKey2, 0, fn.None[chainhash.Hash](),
pubKey1, pubKey2, 0, tapscriptRoot,
)
if err != nil {
return nil, err
@ -1275,7 +1275,7 @@ func (b *Builder) processUpdate(msg interface{},
// reality.
fundingPkScript, err := makeFundingScript(
msg.BitcoinKey1Bytes[:], msg.BitcoinKey2Bytes[:],
msg.Features,
msg.Features, msg.TapscriptRoot,
)
if err != nil {
return err