mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-26 21:51:27 +02:00
lntest: make sure standby nodes' edges are cleaned
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
|
||||
"github.com/lightningnetwork/lnd/lntest/rpc"
|
||||
@@ -308,13 +309,26 @@ func (s *State) updateUTXOStats() {
|
||||
|
||||
// updateEdgeStats counts the total edges.
|
||||
func (s *State) updateEdgeStats() {
|
||||
// filterDisabled is a helper closure that filters out disabled
|
||||
// channels.
|
||||
filterDisabled := func(edge *lnrpc.ChannelEdge) bool {
|
||||
if edge.Node1Policy.Disabled {
|
||||
return false
|
||||
}
|
||||
if edge.Node2Policy.Disabled {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
req := &lnrpc.ChannelGraphRequest{IncludeUnannounced: true}
|
||||
resp := s.rpc.DescribeGraph(req)
|
||||
s.Edge.Total = len(resp.Edges)
|
||||
s.Edge.Total = len(fn.Filter(filterDisabled, resp.Edges))
|
||||
|
||||
req = &lnrpc.ChannelGraphRequest{IncludeUnannounced: false}
|
||||
resp = s.rpc.DescribeGraph(req)
|
||||
s.Edge.Public = len(resp.Edges)
|
||||
s.Edge.Public = len(fn.Filter(filterDisabled, resp.Edges))
|
||||
}
|
||||
|
||||
// updateWalletBalance creates stats for the node's wallet balance.
|
||||
|
Reference in New Issue
Block a user