From 9ccd3056925bf51ffd32024be58193c8584975e4 Mon Sep 17 00:00:00 2001 From: elnosh Date: Sat, 11 Jul 2026 13:19:41 -0400 Subject: [PATCH] rpcserver: fix stats undercount in GetNetworkInfo On an already-seen channel, the loop returned from the whole node callback instead of continuing, skipping the node's remaining channels, this undercounted the stats. --- docs/release-notes/release-notes-0.22.0.md | 6 ++++++ rpcserver.go | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/release-notes/release-notes-0.22.0.md b/docs/release-notes/release-notes-0.22.0.md index e6e3df86b..85626b68f 100644 --- a/docs/release-notes/release-notes-0.22.0.md +++ b/docs/release-notes/release-notes-0.22.0.md @@ -49,6 +49,12 @@ exclude such inputs from sweeping even though their input set could comfortably pay its fees. +* [Fixed a bug](https://github.com/lightningnetwork/lnd/pull/10963) in + `GetNetworkInfo` where encountering an already-seen channel skipped the + rest of that node's channels instead of just that channel, undercounting + the reported network statistics such as total network capacity, channel + count and max out degree. + # New Features ## Functional Enhancements diff --git a/rpcserver.go b/rpcserver.go index 52b682fbc..bfedfbf71 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -6681,11 +6681,10 @@ func (r *rpcServer) GetNetworkInfo(ctx context.Context, // channel encountered. outDegree++ - // If we've already seen this channel, then we'll - // return early to ensure that we don't double-count - // stats. + // If we've already seen this channel, skip it to + // ensure that we don't double-count stats. if _, ok := seenChans[edge.ChannelID]; ok { - return nil + continue } // Compare the capacity of this channel against the