funding: notify aux negotiator on ChannelReady
What changed, and why it matters
This commit adds a small notification hook so that an optional auxiliary channel negotiator is told when a new Lightning channel is ready to use. It is a feature addition, not a fix for a known security problem, and the commit message does not describe any security relevance.
Treat as a routine feature commit. If reviewing for security, verify that any concrete AuxChannelNegotiator implementation safely handles the channel-ready callback and does not perform privileged actions without authorization. No immediate action is required for LND itself because the hook is optional and unimplemented by default.
Security signals we found
New optional callback/hook introduced in channel-ready handling path
Callback receives channel identifier and peer public key
No default implementation supplied; behavior gated by optional interface
Commit message frames change as feature notification, not as security fix
Evidence from the diff
The patch wires a new optional lnwallet.AuxChannelNegotiator into the funding Manager and calls its ProcessChannelReady method inside handleChannelReady, passing the channel ID and peer public key. The hook is wrapped in fn.Option.WhenSome, so it only runs when an auxiliary implementation is registered. No validation, state, or wire-message handling logic is changed for the default LND path.
Changed components
funding/manager.goserver.golnwallet.AuxChannelNegotiator interfaceInspect captured patch +14 / −0
diff --git a/funding/manager.go b/funding/manager.go
index 33d5732..4bfb7f9 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 33b8fd7..ac38940 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
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.