rpcserver: conditionally include channels in GetNodeInfoResponse

This commit is contained in:
Conner Fromknecht 2019-06-17 11:08:44 -07:00
parent 79e0ca3e44
commit a1a3290bda
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

View File

@ -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 {