Fix `aggregation_bits` json serialization.

This commit is contained in:
cheatfate 2021-06-10 20:51:15 +03:00 committed by zah
parent 9193be9b7b
commit b09a3a6b4a
1 changed files with 1 additions and 12 deletions

View File

@ -77,17 +77,6 @@ proc jsonErrorList*(t: typedesc[RestApiResponse],
stream.getOutput(string)
RestApiResponse.error(status, data, "application/json")
template hexCompressed(data: openarray[byte]): string =
let offset =
block:
var res = 0
for i in 0 ..< len(data):
if data[i] != 0x00'u8:
res = i
break
res
"0x" & ncrutils.toHex(data.toOpenArray(offset, len(data) - 1), true)
template hexOriginal(data: openarray[byte]): string =
"0x" & ncrutils.toHex(data, true)
@ -234,7 +223,7 @@ proc readValue*(reader: var JsonReader[RestJson], value: var BitSeq) {.
proc writeValue*(writer: var JsonWriter[RestJson], value: BitSeq) {.
raises: [IOError, Defect].} =
writeValue(writer, hexCompressed(value.bytes()))
writeValue(writer, hexOriginal(value.bytes()))
## BitList
proc readValue*(reader: var JsonReader[RestJson], value: var BitList) =