test_providers: add optional delay during bootstrap
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
7bef1e105f
commit
0431587765
|
@ -29,15 +29,19 @@ import
|
||||||
proc bootstrapNodes(
|
proc bootstrapNodes(
|
||||||
nodecount: int,
|
nodecount: int,
|
||||||
bootnodes: seq[SignedPeerRecord],
|
bootnodes: seq[SignedPeerRecord],
|
||||||
rng = keys.newRng()
|
rng = keys.newRng(),
|
||||||
|
delay: int = 0
|
||||||
) : Future[seq[(discv5_protocol.Protocol, keys.PrivateKey)]] {.async.} =
|
) : Future[seq[(discv5_protocol.Protocol, keys.PrivateKey)]] {.async.} =
|
||||||
|
|
||||||
|
debug "---- STARTING BOOSTRAPS ---"
|
||||||
for i in 0..<nodecount:
|
for i in 0..<nodecount:
|
||||||
let privKey = keys.PrivateKey.random(rng[])
|
let privKey = keys.PrivateKey.random(rng[])
|
||||||
let node = initDiscoveryNode(rng, privKey, localAddress(20302 + i), bootnodes)
|
let node = initDiscoveryNode(rng, privKey, localAddress(20302 + i), bootnodes)
|
||||||
node.start()
|
node.start()
|
||||||
result.add((node, privKey))
|
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
|
#await allFutures(result.mapIt(it.bootstrap())) # this waits for bootstrap based on bootENode, which includes bonding with all its ping pongs
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue