lntest+itest: remove AssertNumActiveEdges

This is no longer needed since we don't have standby nodes, plus it's
causing panic in windows build due to `edge.Policy` being nil.
This commit is contained in:
yyforyongyu committed 2024-12-20 19:38:08 +08:00
1 parent 8f3100c984
commit 7ceb9a4af5
6 files changed
+15 -69

No files matched your search

-54
View File
@@ -19,7 +19,6 @@ import (
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnrpc/invoicesrpc"
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
@@ -241,59 +240,6 @@ func (h *HarnessTest) EnsureConnected(a, b *node.HarnessNode) {
h.AssertPeerConnected(b, a)
}
// AssertNumActiveEdges checks that an expected number of active edges can be
// found in the node specified.
func (h *HarnessTest) AssertNumActiveEdges(hn *node.HarnessNode,
expected int, includeUnannounced bool) []*lnrpc.ChannelEdge {
var edges []*lnrpc.ChannelEdge
old := hn.State.Edge.Public
if includeUnannounced {
old = hn.State.Edge.Total
}
// filterDisabled is a helper closure that filters out disabled
// channels.
filterDisabled := func(edge *lnrpc.ChannelEdge) bool {
if edge.Node1Policy != nil && edge.Node1Policy.Disabled {
return false
}
if edge.Node2Policy != nil && edge.Node2Policy.Disabled {
return false
}
return true
}
err := wait.NoError(func() error {
req := &lnrpc.ChannelGraphRequest{
IncludeUnannounced: includeUnannounced,
}
resp := hn.RPC.DescribeGraph(req)
activeEdges := fn.Filter(resp.Edges, filterDisabled)
total := len(activeEdges)
if total-old == expected {
if expected != 0 {
// NOTE: assume edges come in ascending order
// that the old edges are at the front of the
// slice.
edges = activeEdges[old:]
}
return nil
}
return errNumNotMatched(hn.Name(), "num of channel edges",
expected, total-old, total, old)
}, DefaultTimeout)
require.NoError(h, err, "timeout while checking for edges")
return edges
}
// AssertNumEdges checks that an expected number of edges can be found in the
// node specified.
func (h *HarnessTest) AssertNumEdges(hn *node.HarnessNode,