test fix: init nodes correctly
This commit is contained in:
parent
19792de3dc
commit
54fde4e09e
|
@ -19,7 +19,7 @@ import
|
||||||
./discv5_test_helper,
|
./discv5_test_helper,
|
||||||
libp2p/routing_record
|
libp2p/routing_record
|
||||||
|
|
||||||
proc initProvidersNode*(
|
proc initProvidersNode(
|
||||||
rng: ref BrHmacDrbgContext,
|
rng: ref BrHmacDrbgContext,
|
||||||
privKey: keys.PrivateKey,
|
privKey: keys.PrivateKey,
|
||||||
address: Address,
|
address: Address,
|
||||||
|
@ -27,14 +27,14 @@ proc initProvidersNode*(
|
||||||
ProvidersProtocol =
|
ProvidersProtocol =
|
||||||
|
|
||||||
let d = initDiscoveryNode(rng, privKey, address, bootstrapRecords)
|
let d = initDiscoveryNode(rng, privKey, address, bootstrapRecords)
|
||||||
ProvidersProtocol(discovery: d)
|
newProvidersProtocol(d)
|
||||||
|
|
||||||
proc bootstrapNodes(nodecount: int, bootnodes: openArray[Record], rng = keys.newRng()) : seq[ProvidersProtocol] =
|
proc bootstrapNodes(nodecount: int, bootnodes: openArray[Record], rng = keys.newRng()) : seq[ProvidersProtocol] =
|
||||||
|
|
||||||
for i in 0..<nodecount:
|
for i in 0..<nodecount:
|
||||||
let node = initProvidersNode(rng, keys.PrivateKey.random(rng[]), localAddress(20302 + i), bootnodes)
|
let node = initProvidersNode(rng, keys.PrivateKey.random(rng[]), localAddress(20302 + i), bootnodes)
|
||||||
|
node.discovery.start()
|
||||||
result.add(node)
|
result.add(node)
|
||||||
|
|
||||||
debug "---- STARTING BOOSTRAPS ---"
|
debug "---- STARTING BOOSTRAPS ---"
|
||||||
|
|
||||||
#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