@@ -240,9 +240,9 @@ func (h *HarnessTest) EnsureConnected(a, b *node.HarnessNode) {
240240 h .AssertPeerConnected (b , a )
241241}
242242
243- // AssertNumEdges checks that an expected number of edges can be found in the
244- // node specified.
245- func (h * HarnessTest ) AssertNumEdges (hn * node.HarnessNode ,
243+ // AssertNumActiveEdges checks that an expected number of active edges can be
244+ // found in the node specified.
245+ func (h * HarnessTest ) AssertNumActiveEdges (hn * node.HarnessNode ,
246246 expected int , includeUnannounced bool ) []* lnrpc.ChannelEdge {
247247
248248 var edges []* lnrpc.ChannelEdge
@@ -293,6 +293,45 @@ func (h *HarnessTest) AssertNumEdges(hn *node.HarnessNode,
293293 return edges
294294}
295295
296+ // AssertNumEdges checks that an expected number of edges can be found in the
297+ // node specified.
298+ func (h * HarnessTest ) AssertNumEdges (hn * node.HarnessNode ,
299+ expected int , includeUnannounced bool ) []* lnrpc.ChannelEdge {
300+
301+ var edges []* lnrpc.ChannelEdge
302+
303+ old := hn .State .Edge .Public
304+ if includeUnannounced {
305+ old = hn .State .Edge .Total
306+ }
307+
308+ err := wait .NoError (func () error {
309+ req := & lnrpc.ChannelGraphRequest {
310+ IncludeUnannounced : includeUnannounced ,
311+ }
312+ resp := hn .RPC .DescribeGraph (req )
313+ total := len (resp .Edges )
314+
315+ if total - old == expected {
316+ if expected != 0 {
317+ // NOTE: assume edges come in ascending order
318+ // that the old edges are at the front of the
319+ // slice.
320+ edges = resp .Edges [old :]
321+ }
322+
323+ return nil
324+ }
325+
326+ return errNumNotMatched (hn .Name (), "num of channel edges" ,
327+ expected , total - old , total , old )
328+ }, DefaultTimeout )
329+
330+ require .NoError (h , err , "timeout while checking for edges" )
331+
332+ return edges
333+ }
334+
296335// ReceiveOpenChannelUpdate waits until a message is received on the stream or
297336// the timeout is reached.
298337func (h * HarnessTest ) ReceiveOpenChannelUpdate (
0 commit comments