mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-10 22:36:01 +00:00
Remove temp debugging code; Quit if you fail to connect to the network
This commit is contained in:
parent
31baa77742
commit
69f3095fac
@ -196,14 +196,20 @@ else:
|
|||||||
|
|
||||||
proc connectToNetwork*(node: Eth2Node, bootstrapNodes: seq[PeerInfo]) {.async.} =
|
proc connectToNetwork*(node: Eth2Node, bootstrapNodes: seq[PeerInfo]) {.async.} =
|
||||||
# TODO: perhaps we should do these in parallel
|
# TODO: perhaps we should do these in parallel
|
||||||
|
var connected = false
|
||||||
for bootstrapNode in bootstrapNodes:
|
for bootstrapNode in bootstrapNodes:
|
||||||
try:
|
try:
|
||||||
await node.daemon.connect(bootstrapNode.peer, bootstrapNode.addresses)
|
await node.daemon.connect(bootstrapNode.peer, bootstrapNode.addresses)
|
||||||
let peer = node.getPeer(bootstrapNode.peer)
|
let peer = node.getPeer(bootstrapNode.peer)
|
||||||
await initializeConnection(peer)
|
await initializeConnection(peer)
|
||||||
|
connected = true
|
||||||
except PeerDisconnected:
|
except PeerDisconnected:
|
||||||
error "Failed to connect to bootstrap node", node = bootstrapNode
|
error "Failed to connect to bootstrap node", node = bootstrapNode
|
||||||
|
|
||||||
|
if connected == false:
|
||||||
|
fatal "Failed to connect to any bootstrap node. Quitting."
|
||||||
|
quit 1
|
||||||
|
|
||||||
proc saveConnectionAddressFile*(node: Eth2Node, filename: string) =
|
proc saveConnectionAddressFile*(node: Eth2Node, filename: string) =
|
||||||
let id = waitFor node.daemon.identity()
|
let id = waitFor node.daemon.identity()
|
||||||
Json.saveFile(filename, id, pretty = false)
|
Json.saveFile(filename, id, pretty = false)
|
||||||
|
@ -504,9 +504,7 @@ proc p2pProtocolBackendImpl*(p: P2PProtocol): Backend =
|
|||||||
`streamVar`: `P2PStream`) {.async, gcsafe.} =
|
`streamVar`: `P2PStream`) {.async, gcsafe.} =
|
||||||
let `peerVar` = peerFromStream(`daemonVar`, `streamVar`)
|
let `peerVar` = peerFromStream(`daemonVar`, `streamVar`)
|
||||||
try:
|
try:
|
||||||
debug "INCOMING CONNECTION", `peerVar`
|
|
||||||
`await` `handshakeProcName`(`peerVar`, `streamVar`)
|
`await` `handshakeProcName`(`peerVar`, `streamVar`)
|
||||||
debug "HANDSHAKE COMPLETED", `peerVar`
|
|
||||||
except SerializationError as err:
|
except SerializationError as err:
|
||||||
debug "Failed to decode message",
|
debug "Failed to decode message",
|
||||||
err = err.formatMsg("<msg>"),
|
err = err.formatMsg("<msg>"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user