test_providers: add optional delay during bootstrap

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2022-03-16 22:14:01 +01:00
parent 7bef1e105f
commit 0431587765
1 changed files with 6 additions and 2 deletions

View File

@ -29,15 +29,19 @@ import
proc bootstrapNodes(
nodecount: int,
bootnodes: seq[SignedPeerRecord],
rng = keys.newRng()
rng = keys.newRng(),
delay: int = 0
) : Future[seq[(discv5_protocol.Protocol, keys.PrivateKey)]] {.async.} =
debug "---- STARTING BOOSTRAPS ---"
for i in 0..<nodecount:
let privKey = keys.PrivateKey.random(rng[])
let node = initDiscoveryNode(rng, privKey, localAddress(20302 + i), bootnodes)
node.start()
result.add((node, privKey))
debug "---- STARTING BOOSTRAPS ---"
if delay > 0:
await sleepAsync(chronos.milliseconds(delay))
#await allFutures(result.mapIt(it.bootstrap())) # this waits for bootstrap based on bootENode, which includes bonding with all its ping pongs