@@ -19,6 +19,7 @@ import (
19
19
"github.com/btcsuite/btcd/txscript"
20
20
"github.com/btcsuite/btcd/wire"
21
21
"github.com/lightningnetwork/lnd/channeldb"
22
+ "github.com/lightningnetwork/lnd/fn"
22
23
"github.com/lightningnetwork/lnd/lnrpc"
23
24
"github.com/lightningnetwork/lnd/lnrpc/invoicesrpc"
24
25
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
@@ -251,19 +252,33 @@ func (h *HarnessTest) AssertNumEdges(hn *node.HarnessNode,
251
252
old = hn .State .Edge .Total
252
253
}
253
254
255
+ // filterDisabled is a helper closure that filters out disabled
256
+ // channels.
257
+ filterDisabled := func (edge * lnrpc.ChannelEdge ) bool {
258
+ if edge .Node1Policy .Disabled {
259
+ return false
260
+ }
261
+ if edge .Node2Policy .Disabled {
262
+ return false
263
+ }
264
+
265
+ return true
266
+ }
267
+
254
268
err := wait .NoError (func () error {
255
269
req := & lnrpc.ChannelGraphRequest {
256
270
IncludeUnannounced : includeUnannounced ,
257
271
}
258
- chanGraph := hn .RPC .DescribeGraph (req )
259
- total := len (chanGraph .Edges )
272
+ resp := hn .RPC .DescribeGraph (req )
273
+ activeEdges := fn .Filter (filterDisabled , resp .Edges )
274
+ total := len (activeEdges )
260
275
261
276
if total - old == expected {
262
277
if expected != 0 {
263
278
// NOTE: assume edges come in ascending order
264
279
// that the old edges are at the front of the
265
280
// slice.
266
- edges = chanGraph . Edges [old :]
281
+ edges = activeEdges [old :]
267
282
}
268
283
269
284
return nil
0 commit comments