rpc: don't show pending channel in the ListChannels RPC call

With the concept of open/pending channels on disk, we now will no
longer show channels under ListChannels that are still pending. This
fixes a slight existing bug wherein channels that weren’t yet open
would be listed in this RPC call since we write to disk immediately
after broadcasting the funding transaction.
This commit is contained in:
Olaoluwa Osuntokun 2017-02-24 16:12:24 -08:00
parent f0c13c5a15
commit 178f561a2a
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -814,6 +814,10 @@ func (r *rpcServer) ListChannels(ctx context.Context,
len(dbChannels)) len(dbChannels))
for _, dbChannel := range dbChannels { for _, dbChannel := range dbChannels {
if dbChannel.IsPending {
continue
}
nodePub := dbChannel.IdentityPub.SerializeCompressed() nodePub := dbChannel.IdentityPub.SerializeCompressed()
nodeID := hex.EncodeToString(nodePub) nodeID := hex.EncodeToString(nodePub)
chanPoint := dbChannel.ChanID chanPoint := dbChannel.ChanID