mirror of https://github.com/status-im/nim-eth.git
Fix AssertionError that should be RlpTypeMismatch
This commit is contained in:
parent
87f2a51a1b
commit
9b69910570
|
@ -289,11 +289,14 @@ proc append*(rlpWriter: var RlpWriter, t: Transaction, a: EthAddress) {.inline.}
|
|||
rlpWriter.append(a)
|
||||
|
||||
proc read*(rlp: var Rlp, T: typedesc[HashOrStatus]): T {.inline.} =
|
||||
doAssert(rlp.blobLen() == 32 or rlp.blobLen() == 1)
|
||||
if rlp.blobLen == 1:
|
||||
result = hashOrStatus(rlp.read(uint8) == 1)
|
||||
if rlp.isBlob() and (rlp.blobLen() == 32 or rlp.blobLen() == 1):
|
||||
if rlp.blobLen == 1:
|
||||
result = hashOrStatus(rlp.read(uint8) == 1)
|
||||
else:
|
||||
result = hashOrStatus(rlp.read(Hash256))
|
||||
else:
|
||||
result = hashOrStatus(rlp.read(Hash256))
|
||||
raise newException(RlpTypeMismatch,
|
||||
"HashOrStatus expected, but the source RLP is not a blob of right size.")
|
||||
|
||||
proc append*(rlpWriter: var RlpWriter, value: HashOrStatus) {.inline.} =
|
||||
if value.isHash:
|
||||
|
|
Loading…
Reference in New Issue