lnwallet: introduce AuxChannelNegotiator interface
What changed, and why it matters
This commit only adds a new Go interface definition with no actual implementation or logic. It defines hooks that future code could use to inject custom data during Lightning channel setup and to react when a channel becomes ready. There is no executable code, no change to existing behavior, and no security issue visible in this patch.
No action required. Treat as a normal refactoring/extension-point commit. Security review should focus on future implementations that satisfy this interface and on the callers that will invoke these hooks.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch creates lnwallet/aux_negotiator.go containing the AuxChannelNegotiator interface. It declares four methods for producing and consuming custom TLV records in peer init messages and for receiving ChannelReady/ChannelReestablish notifications. No concrete types, no callers, no state mutations, and no protocol changes are introduced. It is purely an API/extension point.
Changed components
lnwallet/aux_negotiator.goInspect captured patch +34 / −0
diff --git a/lnwallet/aux_negotiator.go b/lnwallet/aux_negotiator.go
new file mode 100644
index 0000000..73096a7
--- /dev/null
+++ b/lnwallet/aux_negotiator.go
@@ -0,0 +1,34 @@
+package lnwallet
+
+import (
+ "github.com/lightningnetwork/lnd/lnwire"
+ "github.com/lightningnetwork/lnd/routing/route"
+)
+
+// AuxChannelNegotiator is an interface that allows aux channel implementations
+// to inject or handle custom records in the init message that is used when
+// establishing a connection with a peer. It may also notify the aux channel
+// implementation for the channel ready or channel reestablish events, which
+// mark the channel as ready to use.
+type AuxChannelNegotiator interface {
+ // GetInitRecords is called when sending an init message to a peer.
+ // It returns custom records to include in the init message TLVs. The
+ // implementation can decide which records to include based on the peer
+ // identity.
+ GetInitRecords(peer route.Vertex) (lnwire.CustomRecords, error)
+
+ // ProcessInitRecords handles received init records from a peer. The
+ // implementation can store state internally to affect future
+ // channel operations with this peer.
+ ProcessInitRecords(peer route.Vertex,
+ customRecords lnwire.CustomRecords) error
+
+ // ProcessChannelReady handles the event of marking a channel identified
+ // by its channel ID as ready to use. We also provide the peer the
+ // channel was established with.
+ ProcessChannelReady(cid lnwire.ChannelID, peer route.Vertex)
+
+ // ProcessReestablish handles the received channel_reestablish message
+ // which marks a channel identified by its cid as ready to use again.
+ ProcessReestablish(cid lnwire.ChannelID, peer route.Vertex)
+}
Why this scored 15/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.