mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-10 14:26:26 +00:00
Address #2489.
This commit is contained in:
parent
477decbcf5
commit
3417871370
@ -339,3 +339,16 @@ proc decodeBody*[T](t: typedesc[T],
|
|||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
return err("Unexpected deserialization error")
|
return err("Unexpected deserialization error")
|
||||||
ok(data)
|
ok(data)
|
||||||
|
|
||||||
|
RestJson.useCustomSerialization(BeaconState.justification_bits):
|
||||||
|
read:
|
||||||
|
let s = reader.readValue(string)
|
||||||
|
if s.len != 4:
|
||||||
|
raiseUnexpectedValue(reader, "A string with 4 characters expected")
|
||||||
|
try:
|
||||||
|
hexToByteArray(s, 1)[0]
|
||||||
|
except ValueError:
|
||||||
|
raiseUnexpectedValue(reader,
|
||||||
|
"The `justification_bits` value must be a hex string")
|
||||||
|
write:
|
||||||
|
writer.writeValue "0x" & toHex([value])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user