Skip to content

Commit

Permalink
Support hex strings prefixed with "0x" in the RPC.
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed Apr 28, 2021
1 parent 58a96d4 commit 28dd39e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Interfaces/RPC/objects/RPCObj.nim
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ template retrieveFromJSON*[T](
elif expectedType is hex:
var res: string
try:
res = retrieveFromJSON(value, string).parseHexStr()
res = retrieveFromJSON(value, string)
if res.substr(0, 1) == "0x":
res = res.substr(2, res.len).parseHexStr()
else:
res = res.parseHexStr()
except ValueError:
raise newLoggedException(ParamError, "retrieveFromJSON expected a hex string.")
res
Expand Down

0 comments on commit 28dd39e

Please sign in to comment.