From 823c8a54f45b4c2d756a523e341fd3e9b346e87d Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Mon, 7 Feb 2022 20:33:14 +0000 Subject: [PATCH] Fix serialization of nested arrays in JSON. Signed-off-by: Daira Hopwood --- zcash_test_vectors/output.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zcash_test_vectors/output.py b/zcash_test_vectors/output.py index 83ef4f3..2c6d54f 100644 --- a/zcash_test_vectors/output.py +++ b/zcash_test_vectors/output.py @@ -28,16 +28,16 @@ def tv_value_json(value, bitcoin_flavoured): value = value.thing def bitcoinify(value): + if type(value) == list: + return [bitcoinify(v) for v in value] + if type(value) == bytes: if bitcoin_flavoured and len(value) == 32: value = value[::-1] value = hexlify(value).decode() return value - if type(value) == list: - return [bitcoinify(v) for v in value] - else: - return bitcoinify(value) + return bitcoinify(value) def tv_json(filename, parts, vectors, bitcoin_flavoured): if type(vectors) == type({}):