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)
|
read = bindSym("read", brForceOpen)
|
||||||
checkedRlpRead = bindSym "checkedRlpRead"
|
checkedRlpRead = bindSym "checkedRlpRead"
|
||||||
startList = bindSym "startList"
|
startList = bindSym "startList"
|
||||||
safeEnterList = bindSym "safeEnterList"
|
enterList = bindSym "enterList"
|
||||||
finish = bindSym "finish"
|
finish = bindSym "finish"
|
||||||
|
|
||||||
messagePrinter = bindSym "messagePrinter"
|
messagePrinter = bindSym "messagePrinter"
|
||||||
|
@ -677,7 +677,7 @@ proc p2pProtocolBackendImpl*(protocol: P2PProtocol): Backend =
|
||||||
|
|
||||||
let
|
let
|
||||||
paramCount = paramsToWrite.len
|
paramCount = paramsToWrite.len
|
||||||
readParamsPrelude = if paramCount > 1: newCall(safeEnterList, receivedRlp)
|
readParamsPrelude = if paramCount > 1: newCall(enterList, receivedRlp)
|
||||||
else: newStmtList()
|
else: newStmtList()
|
||||||
|
|
||||||
when tracingEnabled:
|
when tracingEnabled:
|
||||||
|
|
|
@ -147,17 +147,9 @@ proc append*(rlpWriter: var RlpWriter, value: StatusOptions) =
|
||||||
rlpWriter.append(rlpFromBytes(bytes.toRange))
|
rlpWriter.append(rlpFromBytes(bytes.toRange))
|
||||||
|
|
||||||
proc read*(rlp: var Rlp, T: typedesc[StatusOptions]): T =
|
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()
|
let sz = rlp.listLen()
|
||||||
rlp.enterList()
|
rlp.enterList()
|
||||||
for i in 0 ..< sz:
|
for i in 0 ..< sz:
|
||||||
if not rlp.isList():
|
|
||||||
raise newException(RlpTypeMismatch,
|
|
||||||
"List expected, but the source RLP is not a list.")
|
|
||||||
|
|
||||||
rlp.enterList()
|
rlp.enterList()
|
||||||
var k: KeyKind
|
var k: KeyKind
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -243,13 +243,9 @@ proc currentElemEnd*(self: Rlp): int =
|
||||||
result += payloadOffset() + payloadBytesCount()
|
result += payloadOffset() + payloadBytesCount()
|
||||||
|
|
||||||
proc enterList*(self: var Rlp) =
|
proc enterList*(self: var Rlp) =
|
||||||
doAssert isList()
|
|
||||||
position += payloadOffset()
|
|
||||||
|
|
||||||
proc safeEnterList*(self: var Rlp) =
|
|
||||||
if not isList():
|
if not isList():
|
||||||
raise newException(RlpTypeMismatch, "List expected, but source RLP is not a list")
|
raise newException(RlpTypeMismatch, "List expected, but source RLP is not a list")
|
||||||
enterList()
|
position += payloadOffset()
|
||||||
|
|
||||||
proc skipElem*(rlp: var Rlp) =
|
proc skipElem*(rlp: var Rlp) =
|
||||||
rlp.position = rlp.currentElemEnd
|
rlp.position = rlp.currentElemEnd
|
||||||
|
|
|
@ -384,7 +384,7 @@ proc replaceValue(data: Rlp, key: NibblesRange, value: BytesRange): Bytes =
|
||||||
|
|
||||||
var r = initRlpList(17)
|
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
|
var iter = data
|
||||||
iter.enterList()
|
iter.enterList()
|
||||||
for i in 0 ..< 16:
|
for i in 0 ..< 16:
|
||||||
|
|
Loading…
Reference in New Issue