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:
|
||||
await peer.invokeThunk(msgId, msgData)
|
||||
except RlpError:
|
||||
debug "RlpError, ending dispatchMessages loop", peer
|
||||
debug "RlpError, ending dispatchMessages loop", peer,
|
||||
msg = peer.getMsgName(msgId)
|
||||
await peer.disconnect(BreachOfProtocol, true)
|
||||
return
|
||||
except CatchableError:
|
||||
|
@ -636,7 +637,7 @@ macro p2pProtocolImpl(name: static[string],
|
|||
createPeerState = bindSym "createPeerState"
|
||||
finish = bindSym "finish"
|
||||
initRlpWriter = bindSym "initRlpWriter"
|
||||
enterList = bindSym "enterList"
|
||||
safeEnterList = bindSym "safeEnterList"
|
||||
messagePrinter = bindSym "messagePrinter"
|
||||
initProtocol = bindSym "initProtocol"
|
||||
nextMsgResolver = bindSym "nextMsgResolver"
|
||||
|
@ -875,7 +876,7 @@ macro p2pProtocolImpl(name: static[string],
|
|||
let paramCount = paramsToWrite.len
|
||||
|
||||
if paramCount > 1:
|
||||
readParamsPrelude.add newCall(enterList, receivedRlp)
|
||||
readParamsPrelude.add newCall(safeEnterList, receivedRlp)
|
||||
|
||||
when tracingEnabled:
|
||||
readParams.add newCall(bindSym"logReceivedMsg", msgSender, receivedMsg)
|
||||
|
|
|
@ -90,7 +90,8 @@ p2pProtocol eth(version = protocolVersion,
|
|||
await peer.disconnect(BreachOfProtocol)
|
||||
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])
|
||||
|
||||
|
@ -106,8 +107,9 @@ p2pProtocol eth(version = protocolVersion,
|
|||
proc nodeData(peer: Peer, data: openarray[Blob])
|
||||
|
||||
requestResponse:
|
||||
proc getReceipts(peer: Peer, hashes: openarray[KeccakHash]) =
|
||||
await response.send(peer.network.chain.getReceipts(hashes))
|
||||
proc getReceipts(peer: Peer, hashes: openarray[KeccakHash]) = discard
|
||||
# TODO: implement `getReceipts` and reactivate this code
|
||||
# await response.send(peer.network.chain.getReceipts(hashes))
|
||||
|
||||
proc receipts(peer: Peer, receipts: openarray[Receipt])
|
||||
|
||||
|
|
|
@ -246,6 +246,11 @@ proc enterList*(self: var Rlp) =
|
|||
doAssert isList()
|
||||
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) =
|
||||
rlp.position = rlp.currentElemEnd
|
||||
|
||||
|
|
Loading…
Reference in New Issue