From 9a32bee17171dd8a3435cc66f5f7bf8db080f8aa Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 5 Dec 2017 17:51:06 -0800 Subject: [PATCH] rpc: a link is now only active if it is eligible to forward HTLCs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- rpcserver.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index 0ebf06fcc..f6c857833 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -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