mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 05:14:14 +00:00
Fix for json conversion of hexstrings
This commit is contained in:
parent
c5514155ee
commit
723ef3cf70
@ -90,14 +90,14 @@ proc fromJson*(n: JsonNode, argName: string, result: var HexQuantityStr) =
|
|||||||
n.kind.expect(JString, argName)
|
n.kind.expect(JString, argName)
|
||||||
let hexStr = n.getStr()
|
let hexStr = n.getStr()
|
||||||
if not hexStr.validateHexQuantity:
|
if not hexStr.validateHexQuantity:
|
||||||
raise newException(ValueError, "Parameter \"" & argName & "\" value is not valid as an Ethereum hex quantity \"" & hexStr & "\"")
|
raise newException(ValueError, "Parameter \"" & argName & "\" is not valid as an Ethereum hex quantity \"" & hexStr & "\"")
|
||||||
result = hexStr[2..hexStr.high].hexQuantityStr
|
result = hexStr.hexQuantityStr
|
||||||
|
|
||||||
proc fromJson*(n: JsonNode, argName: string, result: var HexDataStr) =
|
proc fromJson*(n: JsonNode, argName: string, result: var HexDataStr) =
|
||||||
# Note that '0x' is stripped after validation
|
# Note that '0x' is stripped after validation
|
||||||
n.kind.expect(JString, argName)
|
n.kind.expect(JString, argName)
|
||||||
let hexStr = n.getStr()
|
let hexStr = n.getStr()
|
||||||
if not hexStr.validateHexData:
|
if not hexStr.validateHexData:
|
||||||
raise newException(ValueError, "Parameter \"" & argName & "\" value is not valid as a Ethereum data \"" & hexStr & "\"")
|
raise newException(ValueError, "Parameter \"" & argName & "\" is not valid as a Ethereum data \"" & hexStr & "\"")
|
||||||
result = hexStr[2..hexStr.high].hexDataStr
|
result = hexStr.hexDataStr
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user