peer: only return a channel snapshot if the channel can route
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.
This commit is contained in:
parent
1b504b6041
commit
2e090ee2ab
6
peer.go
6
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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user