@@ -20,6 +20,7 @@ import (
2020 "github.com/lightningnetwork/lnd/chainntnfs"
2121 "github.com/lightningnetwork/lnd/channeldb"
2222 "github.com/lightningnetwork/lnd/channeldb/models"
23+ "github.com/lightningnetwork/lnd/fn"
2324 "github.com/lightningnetwork/lnd/keychain"
2425 "github.com/lightningnetwork/lnd/kvdb"
2526 "github.com/lightningnetwork/lnd/lnpeer"
8283// can provide that serve useful when processing a specific network
8384// announcement.
8485type optionalMsgFields struct {
85- capacity * btcutil.Amount
86- channelPoint * wire.OutPoint
87- remoteAlias * lnwire.ShortChannelID
86+ capacity * btcutil.Amount
87+ channelPoint * wire.OutPoint
88+ remoteAlias * lnwire.ShortChannelID
89+ tapscriptRoot fn.Option [chainhash.Hash ]
8890}
8991
9092// apply applies the optional fields within the functional options.
@@ -115,6 +117,14 @@ func ChannelPoint(op wire.OutPoint) OptionalMsgField {
115117 }
116118}
117119
120+ // TapscriptRoot is an optional field that lets the gossiper know of the root of
121+ // the tapscript tree for a custom channel.
122+ func TapscriptRoot (root fn.Option [chainhash.Hash ]) OptionalMsgField {
123+ return func (f * optionalMsgFields ) {
124+ f .tapscriptRoot = root
125+ }
126+ }
127+
118128// RemoteAlias is an optional field that lets the gossiper know that a locally
119129// sent channel update is actually an update for the peer that should replace
120130// the ShortChannelID field with the remote's alias. This is only used for
@@ -2513,6 +2523,9 @@ func (d *AuthenticatedGossiper) handleChanAnnouncement(nMsg *networkMsg,
25132523 cp := * nMsg .optionalMsgFields .channelPoint
25142524 edge .ChannelPoint = cp
25152525 }
2526+
2527+ // Optional tapscript root for custom channels.
2528+ edge .TapscriptRoot = nMsg .optionalMsgFields .tapscriptRoot
25162529 }
25172530
25182531 log .Debugf ("Adding edge for short_chan_id: %v" ,
0 commit comments