mirror of https://github.com/status-im/nim-eth.git
Merge branch 'enterlist'
This commit is contained in:
commit
22bf279b07
|
@ -567,7 +567,7 @@ proc p2pProtocolBackendImpl*(protocol: P2PProtocol): Backend =
|
|||
read = bindSym("read", brForceOpen)
|
||||
checkedRlpRead = bindSym "checkedRlpRead"
|
||||
startList = bindSym "startList"
|
||||
safeEnterList = bindSym "safeEnterList"
|
||||
enterList = bindSym "enterList"
|
||||
finish = bindSym "finish"
|
||||
|
||||
messagePrinter = bindSym "messagePrinter"
|
||||
|
@ -677,7 +677,7 @@ proc p2pProtocolBackendImpl*(protocol: P2PProtocol): Backend =
|
|||
|
||||
let
|
||||
paramCount = paramsToWrite.len
|
||||
readParamsPrelude = if paramCount > 1: newCall(safeEnterList, receivedRlp)
|
||||
readParamsPrelude = if paramCount > 1: newCall(enterList, receivedRlp)
|
||||
else: newStmtList()
|
||||
|
||||
when tracingEnabled:
|
||||
|
|
|
@ -147,17 +147,9 @@ proc append*(rlpWriter: var RlpWriter, value: StatusOptions) =
|
|||
rlpWriter.append(rlpFromBytes(bytes.toRange))
|
||||
|
||||
proc read*(rlp: var Rlp, T: typedesc[StatusOptions]): T =
|
||||
if not rlp.isList():
|
||||
raise newException(RlpTypeMismatch,
|
||||
"List expected, but the source RLP is not a list.")
|
||||
|
||||
let sz = rlp.listLen()
|
||||
rlp.enterList()
|
||||
for i in 0 ..< sz:
|
||||
if not rlp.isList():
|
||||
raise newException(RlpTypeMismatch,
|
||||
"List expected, but the source RLP is not a list.")
|
||||
|
||||
rlp.enterList()
|
||||
var k: KeyKind
|
||||
try:
|
||||
|
|
|
@ -243,13 +243,9 @@ proc currentElemEnd*(self: Rlp): int =
|
|||
result += payloadOffset() + payloadBytesCount()
|
||||
|
||||
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()
|
||||
position += payloadOffset()
|
||||
|
||||
proc skipElem*(rlp: var Rlp) =
|
||||
rlp.position = rlp.currentElemEnd
|
||||
|
|
|
@ -384,7 +384,7 @@ proc replaceValue(data: Rlp, key: NibblesRange, value: BytesRange): Bytes =
|
|||
|
||||
var r = initRlpList(17)
|
||||
|
||||
# XXX: This can be optmized to a direct bitwise copy of the source RLP
|
||||
# XXX: This can be optimized to a direct bitwise copy of the source RLP
|
||||
var iter = data
|
||||
iter.enterList()
|
||||
for i in 0 ..< 16:
|
||||
|
|
Loading…
Reference in New Issue