lnd: handle channel update events in SubscribeChannelEvents
What changed, and why it matters
This commit adds handling for a new type of channel update event in LND's RPC server. Previously, the SubscribeChannelEvents stream likely ignored or dropped ChannelUpdateEvent notifications. The change makes the RPC server emit a properly formatted CHANNEL_UPDATE message to subscribers. There is no direct security vulnerability visible in the diff; it appears to be a missing-feature/bug-fix patch that improves event completeness.
Treat as a routine functional fix. Reviewers may optionally verify that createRPCOpenChannel is safe to call from the subscription goroutine and that no event type is left unhandled, but no immediate security action is indicated.
Security signals we found
No security-relevant signals identified in the diff
Change is purely an event-delivery completeness fix
Evidence from the diff
The patch extends the SubscribeChannelEvents RPC handler in rpcserver.go to handle channelnotifier.ChannelUpdateEvent. When such an event occurs, it builds an lnrpc.ChannelEventUpdate of type CHANNEL_UPDATE containing an UpdatedChannel (ChannelCommitUpdate) populated by createRPCOpenChannel. The change is additive (+18 lines) and follows the same pattern as existing event types (Active/Inactive/Closed/etc.). No input validation, authorization, or cryptographic logic is modified.
Changed components
rpcserver.goSubscribeChannelEvents RPCchannelnotifier.ChannelUpdateEvent handlingInspect captured patch +18 / −0
diff --git a/rpcserver.go b/rpcserver.go
index 564d8cc..8cbeb74 100644
--- a/rpcserver.go
+++ b/rpcserver.go
@@ -5488,6 +5488,24 @@ func (r *rpcServer) SubscribeChannelEvents(req *lnrpc.ChannelEventSubscription,
},
}
+ case channelnotifier.ChannelUpdateEvent:
+ channel, err := createRPCOpenChannel(
+ updateStream.Context(),
+ r, event.Channel, true, false,
+ )
+ if err != nil {
+ return err
+ }
+
+ update = &lnrpc.ChannelEventUpdate{
+ Type: lnrpc.ChannelEventUpdate_CHANNEL_UPDATE,
+ Channel: &lnrpc.ChannelEventUpdate_UpdatedChannel{
+ UpdatedChannel: &lnrpc.ChannelCommitUpdate{
+ Channel: channel,
+ },
+ },
+ }
+
case channelnotifier.InactiveChannelEvent:
update = &lnrpc.ChannelEventUpdate{
Type: lnrpc.ChannelEventUpdate_INACTIVE_CHANNEL,
Why this scored 16/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.