lnd_test: allow assertNumConnections to exit early
This commit is contained in:
1 parent
8930b4e481
commit
84a0806da4
1 file changed
+8
@@ -290,6 +290,8 @@ func assertNumConnections(
|
|||||||
bob.nodeID, err)
|
bob.nodeID, err)
|
||||||
}
|
}
|
||||||
if len(aNumPeers.Peers) != expected {
|
if len(aNumPeers.Peers) != expected {
|
||||||
|
// Continue polling if this is not the final
|
||||||
|
// loop.
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -297,12 +299,18 @@ func assertNumConnections(
|
|||||||
"expected %v, got %v", expected, len(aNumPeers.Peers))
|
"expected %v, got %v", expected, len(aNumPeers.Peers))
|
||||||
}
|
}
|
||||||
if len(bNumPeers.Peers) != expected {
|
if len(bNumPeers.Peers) != expected {
|
||||||
|
// Continue polling if this is not the final
|
||||||
|
// loop.
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
t.Fatalf("number of peers connected to bob is incorrect: "+
|
t.Fatalf("number of peers connected to bob is incorrect: "+
|
||||||
"expected %v, got %v", expected, len(bNumPeers.Peers))
|
"expected %v, got %v", expected, len(bNumPeers.Peers))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Alice and Bob both have the required number of
|
||||||
|
// peers, stop polling and return to caller.
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user