mirror of https://github.com/status-im/nim-eth.git
Fix two AssertionErrors from being raised all the way up
This commit is contained in:
parent
f068a54312
commit
dc02a5b28d
|
@ -554,7 +554,8 @@ proc dispatchMessages*(peer: Peer) {.async.} =
|
||||||
try:
|
try:
|
||||||
await peer.invokeThunk(msgId, msgData)
|
await peer.invokeThunk(msgId, msgData)
|
||||||
except RlpError:
|
except RlpError:
|
||||||
debug "RlpError, ending dispatchMessages loop", peer
|
debug "RlpError, ending dispatchMessages loop", peer,
|
||||||
|
msg = peer.getMsgName(msgId)
|
||||||
await peer.disconnect(BreachOfProtocol, true)
|
await peer.disconnect(BreachOfProtocol, true)
|
||||||
return
|
return
|
||||||
except CatchableError:
|
except CatchableError:
|
||||||
|
@ -636,7 +637,7 @@ macro p2pProtocolImpl(name: static[string],
|
||||||
createPeerState = bindSym "createPeerState"
|
createPeerState = bindSym "createPeerState"
|
||||||
finish = bindSym "finish"
|
finish = bindSym "finish"
|
||||||
initRlpWriter = bindSym "initRlpWriter"
|
initRlpWriter = bindSym "initRlpWriter"
|
||||||
enterList = bindSym "enterList"
|
safeEnterList = bindSym "safeEnterList"
|
||||||
messagePrinter = bindSym "messagePrinter"
|
messagePrinter = bindSym "messagePrinter"
|
||||||
initProtocol = bindSym "initProtocol"
|
initProtocol = bindSym "initProtocol"
|
||||||
nextMsgResolver = bindSym "nextMsgResolver"
|
nextMsgResolver = bindSym "nextMsgResolver"
|
||||||
|
@ -875,7 +876,7 @@ macro p2pProtocolImpl(name: static[string],
|
||||||
let paramCount = paramsToWrite.len
|
let paramCount = paramsToWrite.len
|
||||||
|
|
||||||
if paramCount > 1:
|
if paramCount > 1:
|
||||||
readParamsPrelude.add newCall(enterList, receivedRlp)
|
readParamsPrelude.add newCall(safeEnterList, receivedRlp)
|
||||||
|
|
||||||
when tracingEnabled:
|
when tracingEnabled:
|
||||||
readParams.add newCall(bindSym"logReceivedMsg", msgSender, receivedMsg)
|
readParams.add newCall(bindSym"logReceivedMsg", msgSender, receivedMsg)
|
||||||
|
|
|
@ -90,7 +90,8 @@ p2pProtocol eth(version = protocolVersion,
|
||||||
await peer.disconnect(BreachOfProtocol)
|
await peer.disconnect(BreachOfProtocol)
|
||||||
return
|
return
|
||||||
|
|
||||||
await response.send(peer.network.chain.getBlockBodies(hashes))
|
# TODO: implement `getBlockBodies` and reactivate this code
|
||||||
|
# await response.send(peer.network.chain.getBlockBodies(hashes))
|
||||||
|
|
||||||
proc blockBodies(peer: Peer, blocks: openarray[BlockBody])
|
proc blockBodies(peer: Peer, blocks: openarray[BlockBody])
|
||||||
|
|
||||||
|
@ -106,8 +107,9 @@ p2pProtocol eth(version = protocolVersion,
|
||||||
proc nodeData(peer: Peer, data: openarray[Blob])
|
proc nodeData(peer: Peer, data: openarray[Blob])
|
||||||
|
|
||||||
requestResponse:
|
requestResponse:
|
||||||
proc getReceipts(peer: Peer, hashes: openarray[KeccakHash]) =
|
proc getReceipts(peer: Peer, hashes: openarray[KeccakHash]) = discard
|
||||||
await response.send(peer.network.chain.getReceipts(hashes))
|
# TODO: implement `getReceipts` and reactivate this code
|
||||||
|
# await response.send(peer.network.chain.getReceipts(hashes))
|
||||||
|
|
||||||
proc receipts(peer: Peer, receipts: openarray[Receipt])
|
proc receipts(peer: Peer, receipts: openarray[Receipt])
|
||||||
|
|
||||||
|
|
|
@ -246,6 +246,11 @@ proc enterList*(self: var Rlp) =
|
||||||
doAssert isList()
|
doAssert isList()
|
||||||
position += payloadOffset()
|
position += payloadOffset()
|
||||||
|
|
||||||
|
proc safeEnterList*(self: var Rlp) =
|
||||||
|
if not isList():
|
||||||
|
raise newException(RlpTypeMismatch, "List expected, but source RLP is not a list")
|
||||||
|
enterList()
|
||||||
|
|
||||||
proc skipElem*(rlp: var Rlp) =
|
proc skipElem*(rlp: var Rlp) =
|
||||||
rlp.position = rlp.currentElemEnd
|
rlp.position = rlp.currentElemEnd
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue