htlcswitch+peer: set and read aux custom records

This is the final step, we actually call the interface and either
provide or retrieve the custom features over the message. We also notify
the aux components when channel reestablish is received.
This commit is contained in:
George Tsagkarelis
2025-08-28 13:45:29 +02:00
parent 68bd35f7ad
commit 6dff1bd5de
3 changed files with 67 additions and 2 deletions

View File

@@ -298,6 +298,11 @@ type ChannelLinkConfig struct {
// used to manage the bandwidth of the link.
AuxTrafficShaper fn.Option[AuxTrafficShaper]
// AuxChannelNegotiator is an optional interface that allows aux channel
// implementations to inject and process custom records over channel
// related wire messages.
AuxChannelNegotiator fn.Option[lnwallet.AuxChannelNegotiator]
// QuiescenceTimeout is the max duration that the channel can be
// quiesced. Any dependent protocols (dynamic commitments, splicing,
// etc.) must finish their operations under this timeout value,
@@ -987,6 +992,22 @@ func (l *channelLink) syncChanStates(ctx context.Context) error {
// In any case, we'll then process their ChanSync message.
l.log.Info("received re-establishment message from remote side")
// If we have an AuxChannelNegotiator we notify any external
// component for this message. This serves as a notification
// that the reestablish message was received.
l.cfg.AuxChannelNegotiator.WhenSome(
func(acn lnwallet.AuxChannelNegotiator) {
fundingPoint := l.channel.ChannelPoint()
cid := lnwire.NewChanIDFromOutPoint(
fundingPoint,
)
acn.ProcessReestablish(
cid, l.cfg.Peer.PubKey(),
)
},
)
var (
openedCircuits []CircuitKey
closedCircuits []CircuitKey