From a1a3290bdaa7d7957b8610fe9bc9b297916da087 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Mon, 17 Jun 2019 11:08:44 -0700 Subject: [PATCH] rpcserver: conditionally include channels in GetNodeInfoResponse --- rpcserver.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index 71498f7e..f9dad316 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -3821,15 +3821,20 @@ func (r *rpcServer) GetNodeInfo(ctx context.Context, numChannels++ totalCapacity += edge.Capacity - // Do not include unannounced channels - private channels or public - // channels whose authentication proof were not confirmed yet. - if edge.AuthProof == nil { - return nil - } + // Only populate the node's channels if the user requested them. + if in.IncludeChannels { + // Do not include unannounced channels - private + // channels or public channels whose authentication + // proof were not confirmed yet. + if edge.AuthProof == nil { + return nil + } - // Convert the database's edge format into the network/RPC edge format. - channelEdge := marshalDbEdge(edge, c1, c2) - channels = append(channels, channelEdge) + // Convert the database's edge format into the + // network/RPC edge format. + channelEdge := marshalDbEdge(edge, c1, c2) + channels = append(channels, channelEdge) + } return nil }); err != nil {