Remove temp debugging code; Quit if you fail to connect to the network

This commit is contained in:
Zahary Karadjov 2019-06-24 19:27:19 +03:00 committed by zah
parent 31baa77742
commit 69f3095fac
2 changed files with 6 additions and 2 deletions

View File

@ -196,14 +196,20 @@ else:
proc connectToNetwork*(node: Eth2Node, bootstrapNodes: seq[PeerInfo]) {.async.} =
# TODO: perhaps we should do these in parallel
var connected = false
for bootstrapNode in bootstrapNodes:
try:
await node.daemon.connect(bootstrapNode.peer, bootstrapNode.addresses)
let peer = node.getPeer(bootstrapNode.peer)
await initializeConnection(peer)
connected = true
except PeerDisconnected:
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) =
let id = waitFor node.daemon.identity()
Json.saveFile(filename, id, pretty = false)

View File

@ -504,9 +504,7 @@ proc p2pProtocolBackendImpl*(p: P2PProtocol): Backend =
`streamVar`: `P2PStream`) {.async, gcsafe.} =
let `peerVar` = peerFromStream(`daemonVar`, `streamVar`)
try:
debug "INCOMING CONNECTION", `peerVar`
`await` `handshakeProcName`(`peerVar`, `streamVar`)
debug "HANDSHAKE COMPLETED", `peerVar`
except SerializationError as err:
debug "Failed to decode message",
err = err.formatMsg("<msg>"),