mirror of https://github.com/status-im/nim-eth.git
Merge branch 'master' of github.com:status-im/nim-eth
This commit is contained in:
commit
7ec1433b01
|
@ -384,7 +384,7 @@ proc decodeAuthMessageEip8(h: var Handshake, m: openarray[byte]): AuthStatus =
|
||||||
h.remoteHPubkey = pubkey
|
h.remoteHPubkey = pubkey
|
||||||
h.version = cast[ptr byte](versionBr.baseAddr)[]
|
h.version = cast[ptr byte](versionBr.baseAddr)[]
|
||||||
result = Success
|
result = Success
|
||||||
except:
|
except CatchableError:
|
||||||
result = RlpError
|
result = RlpError
|
||||||
|
|
||||||
proc decodeAckMessageEip8*(h: var Handshake, m: openarray[byte]): AuthStatus =
|
proc decodeAckMessageEip8*(h: var Handshake, m: openarray[byte]): AuthStatus =
|
||||||
|
@ -417,7 +417,7 @@ proc decodeAckMessageEip8*(h: var Handshake, m: openarray[byte]): AuthStatus =
|
||||||
copyMem(addr h.responderNonce[0], nonceBr.baseAddr, KeyLength)
|
copyMem(addr h.responderNonce[0], nonceBr.baseAddr, KeyLength)
|
||||||
h.version = cast[ptr byte](versionBr.baseAddr)[]
|
h.version = cast[ptr byte](versionBr.baseAddr)[]
|
||||||
result = Success
|
result = Success
|
||||||
except:
|
except CatchableError:
|
||||||
result = RlpError
|
result = RlpError
|
||||||
|
|
||||||
proc decodeAckMessageV4(h: var Handshake, m: openarray[byte]): AuthStatus =
|
proc decodeAckMessageV4(h: var Handshake, m: openarray[byte]): AuthStatus =
|
||||||
|
|
|
@ -164,7 +164,7 @@ proc obtainBlocksFromPeer(syncCtx: SyncContext, peer: Peer) {.async.} =
|
||||||
if bestBlockNumber > syncCtx.endBlockNumber:
|
if bestBlockNumber > syncCtx.endBlockNumber:
|
||||||
trace "New sync end block number", number = bestBlockNumber
|
trace "New sync end block number", number = bestBlockNumber
|
||||||
syncCtx.endBlockNumber = bestBlockNumber
|
syncCtx.endBlockNumber = bestBlockNumber
|
||||||
except:
|
except CatchableError:
|
||||||
debug "Exception in getBestBlockNumber()",
|
debug "Exception in getBestBlockNumber()",
|
||||||
exc = getCurrentException().name,
|
exc = getCurrentException().name,
|
||||||
err = getCurrentExceptionMsg()
|
err = getCurrentExceptionMsg()
|
||||||
|
@ -210,7 +210,7 @@ proc obtainBlocksFromPeer(syncCtx: SyncContext, peer: Peer) {.async.} =
|
||||||
dataReceived = true
|
dataReceived = true
|
||||||
else:
|
else:
|
||||||
warn "Bodies len != headers.len", bodies = bodies.len, headers = workItem.headers.len
|
warn "Bodies len != headers.len", bodies = bodies.len, headers = workItem.headers.len
|
||||||
except:
|
except CatchableError:
|
||||||
# the success case sets `dataReceived`, so we can just fall back to the
|
# the success case sets `dataReceived`, so we can just fall back to the
|
||||||
# failure path below. If we signal time-outs with exceptions such
|
# failure path below. If we signal time-outs with exceptions such
|
||||||
# failures will be easier to handle.
|
# failures will be easier to handle.
|
||||||
|
@ -231,7 +231,7 @@ proc obtainBlocksFromPeer(syncCtx: SyncContext, peer: Peer) {.async.} =
|
||||||
workItem.state = Initial
|
workItem.state = Initial
|
||||||
try:
|
try:
|
||||||
await peer.disconnect(SubprotocolReason)
|
await peer.disconnect(SubprotocolReason)
|
||||||
except:
|
except CatchableError:
|
||||||
discard
|
discard
|
||||||
syncCtx.handleLostPeer()
|
syncCtx.handleLostPeer()
|
||||||
break
|
break
|
||||||
|
@ -318,7 +318,7 @@ proc onPeerConnected(ctx: SyncContext, peer: Peer) =
|
||||||
f.callback = proc(data: pointer) {.gcsafe.} =
|
f.callback = proc(data: pointer) {.gcsafe.} =
|
||||||
if f.failed:
|
if f.failed:
|
||||||
error "startSyncWithPeer failed", msg = f.readError.msg, peer
|
error "startSyncWithPeer failed", msg = f.readError.msg, peer
|
||||||
except:
|
except CatchableError:
|
||||||
debug "Exception in startSyncWithPeer()",
|
debug "Exception in startSyncWithPeer()",
|
||||||
exc = getCurrentException().name,
|
exc = getCurrentException().name,
|
||||||
err = getCurrentExceptionMsg()
|
err = getCurrentExceptionMsg()
|
||||||
|
|
|
@ -258,6 +258,7 @@ proc processClient(transp: DatagramTransport,
|
||||||
proto.receive(a, buf)
|
proto.receive(a, buf)
|
||||||
except:
|
except:
|
||||||
debug "Receive failed", err = getCurrentExceptionMsg()
|
debug "Receive failed", err = getCurrentExceptionMsg()
|
||||||
|
raise
|
||||||
|
|
||||||
proc open*(d: DiscoveryProtocol) =
|
proc open*(d: DiscoveryProtocol) =
|
||||||
# TODO allow binding to specific IP / IPv6 / etc
|
# TODO allow binding to specific IP / IPv6 / etc
|
||||||
|
|
|
@ -198,6 +198,7 @@ proc requestResolver[MsgType](msg: pointer, future: FutureBase) {.gcsafe.} =
|
||||||
debug "Exception in requestResolver()",
|
debug "Exception in requestResolver()",
|
||||||
exc = getCurrentException().name,
|
exc = getCurrentException().name,
|
||||||
err = getCurrentExceptionMsg()
|
err = getCurrentExceptionMsg()
|
||||||
|
raise
|
||||||
|
|
||||||
proc registerMsg(protocol: ProtocolInfo,
|
proc registerMsg(protocol: ProtocolInfo,
|
||||||
id: int, name: string,
|
id: int, name: string,
|
||||||
|
|
Loading…
Reference in New Issue