Start libp2p before writing ENR file (#1418)
this makes sure that all libp2p transports are open for business when the file hits the ground
This commit is contained in:
parent
52d9d269d7
commit
d22a2cec2b
|
@ -852,7 +852,7 @@ proc createPidFile(filename: string) =
|
|||
addQuitProc proc {.noconv.} = removeFile gPidFile
|
||||
|
||||
proc initializeNetworking(node: BeaconNode) {.async.} =
|
||||
node.network.startListening()
|
||||
await node.network.startListening()
|
||||
|
||||
let addressFile = node.config.dataDir / "beacon_node.enr"
|
||||
writeFile(addressFile, node.network.announcedENR.toURI)
|
||||
|
|
|
@ -882,14 +882,14 @@ template publicKey*(node: Eth2Node): keys.PublicKey =
|
|||
template addKnownPeer*(node: Eth2Node, peer: enr.Record) =
|
||||
node.discovery.addNode peer
|
||||
|
||||
proc startListening*(node: Eth2Node) =
|
||||
proc startListening*(node: Eth2Node) {.async.} =
|
||||
node.discovery.open()
|
||||
node.libp2pTransportLoops = await node.switch.start()
|
||||
|
||||
proc start*(node: Eth2Node) {.async.} =
|
||||
for i in 0 ..< ConcurrentConnections:
|
||||
node.connWorkers.add connectWorker(node)
|
||||
|
||||
node.libp2pTransportLoops = await node.switch.start()
|
||||
node.discovery.start()
|
||||
node.discoveryLoop = node.runDiscoveryLoop()
|
||||
traceAsyncErrors node.discoveryLoop
|
||||
|
|
Loading…
Reference in New Issue