Skip to content

Commit e24e285

Browse files
committed
funding: notify aux negotiator on ChannelReady
We notify the aux channel negotiator that an established channel is now ready to use. This helps correlate the peer custom features with the channel identifier of the ready channel.
1 parent 8993c7f commit e24e285

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

funding/manager.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,11 @@ type Config struct {
569569
// AuxResolver is an optional interface that can be used to modify the
570570
// way contracts are resolved.
571571
AuxResolver fn.Option[lnwallet.AuxContractResolver]
572+
573+
// AuxChannelNegotiator is an optional interface that allows aux channel
574+
// implementations to inject and process feature bits during init and
575+
// channel_reestablish messages.
576+
AuxChannelNegotiator fn.Option[lnwallet.AuxChannelNegotiator]
572577
}
573578

574579
// Manager acts as an orchestrator/bridge between the wallet's
@@ -3914,6 +3919,14 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer, //nolint:funlen
39143919

39153920
defer f.wg.Done()
39163921

3922+
// Notify the aux hook that the specified peer just established a
3923+
// channel with us, identified by the given channel ID.
3924+
f.cfg.AuxChannelNegotiator.WhenSome(
3925+
func(acn lnwallet.AuxChannelNegotiator) {
3926+
acn.ProcessChannelReady(msg.ChanID, peer.PubKey())
3927+
},
3928+
)
3929+
39173930
// If we are in development mode, we'll wait for specified duration
39183931
// before processing the channel ready message.
39193932
if f.cfg.Dev != nil {

server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,6 +1627,7 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
16271627
AuxFundingController: implCfg.AuxFundingController,
16281628
AuxSigner: implCfg.AuxSigner,
16291629
AuxResolver: implCfg.AuxContractResolver,
1630+
AuxChannelNegotiator: implCfg.AuxChannelNegotiator,
16301631
})
16311632
if err != nil {
16321633
return nil, err

0 commit comments

Comments
 (0)