From 92d6984842a9f877e7270b5f18ad21e3ebccfac1 Mon Sep 17 00:00:00 2001 From: str4d Date: Sun, 20 Jun 2021 21:25:59 +0100 Subject: [PATCH] test: Cleanups to ZIP 221 Python test code Co-authored-by: Daira Hopwood --- qa/rpc-tests/feature_zip221.py | 2 +- qa/rpc-tests/test_framework/flyclient.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/qa/rpc-tests/feature_zip221.py b/qa/rpc-tests/feature_zip221.py index dcb7748a1..e2e6bdcc4 100755 --- a/qa/rpc-tests/feature_zip221.py +++ b/qa/rpc-tests/feature_zip221.py @@ -9,8 +9,8 @@ from test_framework.mininode import (CBlockHeader) from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( BLOSSOM_BRANCH_ID, - CANOPY_BRANCH_ID, HEARTWOOD_BRANCH_ID, + CANOPY_BRANCH_ID, NU5_BRANCH_ID, assert_equal, bytes_to_hex_str, diff --git a/qa/rpc-tests/test_framework/flyclient.py b/qa/rpc-tests/test_framework/flyclient.py index cb4dafc18..368c6516c 100644 --- a/qa/rpc-tests/test_framework/flyclient.py +++ b/qa/rpc-tests/test_framework/flyclient.py @@ -32,9 +32,10 @@ class ZcashMMRNode(): nEarliestHeight: int nLatestHeight: int nSaplingTxCount: int # number of Sapling transactions in block - hashEarliestOrchardRoot: bytes # left child's Orchard root - hashLatestOrchardRoot: bytes # right child's Orchard root - nOrchardTxCount: int # number of Orchard transactions in block + # NU5 only. + hashEarliestOrchardRoot: Optional[bytes] # left child's Orchard root + hashLatestOrchardRoot: Optional[bytes] # right child's Orchard root + nOrchardTxCount: Optional[int] # number of Orchard transactions in block consensusBranchId: bytes @@ -116,10 +117,10 @@ def make_parent( parent.nSaplingTxCount = left_child.nSaplingTxCount + right_child.nSaplingTxCount parent.hashEarliestOrchardRoot = left_child.hashEarliestOrchardRoot parent.hashLatestOrchardRoot = right_child.hashLatestOrchardRoot - parent.nOrchardTxCount = \ - left_child.nOrchardTxCount + right_child.nOrchardTxCount \ - if left_child.nOrchardTxCount is not None and right_child.nOrchardTxCount is not None \ - else None + parent.nOrchardTxCount = ( + left_child.nOrchardTxCount + right_child.nOrchardTxCount + if left_child.nOrchardTxCount is not None and right_child.nOrchardTxCount is not None + else None) parent.consensusBranchId = left_child.consensusBranchId return parent