diff --git a/funding/manager.go b/funding/manager.go index 33d57328e..4bfb7f9d0 100644 --- a/funding/manager.go +++ b/funding/manager.go @@ -568,6 +568,11 @@ type Config struct { // AuxResolver is an optional interface that can be used to modify the // way contracts are resolved. AuxResolver fn.Option[lnwallet.AuxContractResolver] + + // 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] } // Manager acts as an orchestrator/bridge between the wallet's @@ -4019,6 +4024,14 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer, //nolint:funlen defer f.wg.Done() + // Notify the aux hook that the specified peer just established a + // channel with us, identified by the given channel ID. + f.cfg.AuxChannelNegotiator.WhenSome( + func(acn lnwallet.AuxChannelNegotiator) { + acn.ProcessChannelReady(msg.ChanID, peer.PubKey()) + }, + ) + // If we are in development mode, we'll wait for specified duration // before processing the channel ready message. if f.cfg.Dev != nil { diff --git a/server.go b/server.go index 33b8fd787..ac3894012 100644 --- a/server.go +++ b/server.go @@ -1628,6 +1628,7 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr, AuxFundingController: implCfg.AuxFundingController, AuxSigner: implCfg.AuxSigner, AuxResolver: implCfg.AuxContractResolver, + AuxChannelNegotiator: implCfg.AuxChannelNegotiator, }) if err != nil { return nil, err