From 2e090ee2ab4b7ea4ea390c1b87f3c5adc7a0d8d5 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 8 Feb 2018 19:40:48 -0800 Subject: [PATCH] peer: only return a channel snapshot if the channel can route MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In this commit, we fix a slight miscalculation within the GetInfo call. Before this commit, we would list any channel that the peer knew of as active, instead of those which are, well, actually *active*. We fix this by skipping any channels that we don’t have the remote revocation for. --- peer.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/peer.go b/peer.go index b950a536..ae2bf40f 100644 --- a/peer.go +++ b/peer.go @@ -1160,6 +1160,12 @@ func (p *peer) ChannelSnapshots() []*channeldb.ChannelSnapshot { snapshots := make([]*channeldb.ChannelSnapshot, 0, len(p.activeChannels)) for _, activeChan := range p.activeChannels { + // We'll only return a snapshot for channels that are + // *immedately* available for routing payments over. + if activeChan.RemoteNextRevocation() == nil { + continue + } + snapshot := activeChan.StateSnapshot() snapshots = append(snapshots, snapshot) }