rpc: a link is now only active if it is eligible to forward HTLCs

In this commit, we further constrain the candidacy for an “active”
channel. In addition to being present within the link, it *must* also
have the RemoteNextRevocation set. Otherwise, this indicates that we
haven’t yet processed a FundingLocked message for this channel.
This commit is contained in:
Olaoluwa Osuntokun 2017-12-05 17:51:06 -08:00
parent be1a96b78a
commit 9a32bee171
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

View File

@ -1465,8 +1465,11 @@ func (r *rpcServer) ListChannels(ctx context.Context,
channelID := lnwire.NewChanIDFromOutPoint(&chanPoint)
var linkActive bool
if _, err := r.server.htlcSwitch.GetLink(channelID); err == nil {
linkActive = true
if link, err := r.server.htlcSwitch.GetLink(channelID); err == nil {
// A channel is only considered active if it is known
// by the switch *and* able to forward
// incoming/outgoing payments.
linkActive = link.EligibleToForward()
}
// As this is required for display purposes, we'll calculate