qa: port 12 wallet/mining tests to python3 and fix three framework blockers
Ports qa/rpc-tests from 6 python3 files to 18. Ran every ported test against
the freshly built v1.3.0 dragonxd. Results, honestly:
PASS (1) getblocktemplate_proposals.py
NOT APPLICABLE (7) wallet.py, walletbackup.py, wallet_protectcoinbase.py,
wallet_listnotes.py, wallet_mergetoaddress.py,
getblocktemplate.py, wallet_shieldcoinbase.py
BLOCKED (4) wallet_sapling, wallet_nullifiers, wallet_persistence,
wallet_treestate
The "not applicable" seven are inherited Zcash/Hush-era tests that exercise
features DragonX deliberately removed. They assume transparent t->t value
transfer, but ASSETCHAINS_PRIVATE=1 (hush_utils.h:1826) makes sendtoaddress
and sendmany consensus-refuse; they assume Sprout joinsplits, which are gone
from the RPC layer entirely; and they hardcode Bitcoin economics (10 coin/block,
100-block maturity) against DragonX's 3 DRGX and COINBASE_MATURITY=1. They are
ported and left in place rather than deleted, but they cannot pass on this chain
without being rewritten around z_shieldcoinbase/autoshield.
Three framework fixes in test_framework/util.py, each of which broke every
multi-node test:
- initialize_chain() passed -connect=0, and init.cpp soft-sets -listen=0 when
-connect is present, so cache node0 never opened its p2p port and nodes 1-3
could never sync to it -- initialize_chain() hung forever in sync_blocks().
Now passes -listen=1 -bind=127.0.0.1 -dnsseed=0 explicitly (an explicit arg
beats SoftSetBoolArg) while keeping the cache nodes off the public network.
- cache cleanup removed files from <datadir> when dragonxd writes them one
level deeper into the net-specific <datadir>/regtest.
- set_node_times() did print("..." + t) with t an int -> TypeError.
- default binary paths corrected to src/dragonxd and src/dragonx-cli.
The four BLOCKED tests are blocked by a daemon assert, not by the port; see the
follow-up commit/report on BLOCK_VALID_CONTEXT.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FU87LdsJZiZkfq1eXubpeo
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2016-2024 The Hush developers
|
||||
# Copyright (c) 2018 The Zcash developers
|
||||
# Distributed under the GPLv3 software license, see the accompanying
|
||||
@@ -13,6 +13,29 @@ from test_framework.util import (
|
||||
)
|
||||
from decimal import Decimal
|
||||
|
||||
def get_value_pool(pools, pool_id):
|
||||
"""
|
||||
Return the valuePools entry with the given id, or None if this chain does
|
||||
not have that pool. DragonX's getblockchaininfo only reports the Sapling
|
||||
pool (no Sprout history exists on this chain), so the pools list can no
|
||||
longer be indexed positionally the way the upstream test did.
|
||||
"""
|
||||
for pool in pools:
|
||||
if pool['id'] == pool_id:
|
||||
return pool
|
||||
return None
|
||||
|
||||
def assert_pool_values(pools, sprout_value, sapling_value):
|
||||
sprout = get_value_pool(pools, 'sprout')
|
||||
if sprout is not None:
|
||||
assert_equal(sprout['chainValue'], sprout_value)
|
||||
else:
|
||||
# No Sprout pool at all is the same statement as "the Sprout pool holds nothing"
|
||||
assert_equal(sprout_value, Decimal('0'))
|
||||
sapling = get_value_pool(pools, 'sapling')
|
||||
assert_true(sapling is not None, "Sapling value pool missing from getblockchaininfo")
|
||||
assert_equal(sapling['chainValue'], sapling_value)
|
||||
|
||||
class WalletPersistenceTest (BitcoinTestFramework):
|
||||
|
||||
def setup_chain(self):
|
||||
@@ -20,8 +43,20 @@ class WalletPersistenceTest (BitcoinTestFramework):
|
||||
initialize_chain_clean(self.options.tmpdir, 3)
|
||||
|
||||
def setup_network(self, split=False):
|
||||
# -listen=1/-bind: the framework's start_node() passes -connect=0, and DragonX (like
|
||||
# Bitcoin) reacts to -connect by soft-setting -listen=0. A non-listening node can never
|
||||
# accept the "addnode 127.0.0.1:<port>" that connect_nodes_bi() issues, so without this
|
||||
# the three nodes stay isolated and sync_all() spins forever. -bind keeps the listener on
|
||||
# loopback so a regtest node never becomes reachable from the public internet.
|
||||
self.nodes = start_nodes(3, self.options.tmpdir,
|
||||
extra_args=[[
|
||||
'-listen=1',
|
||||
'-bind=127.0.0.1',
|
||||
# -dns=0: DragonX appends node1..node10.dragonx.is to -addnode for every chain
|
||||
# named DRAGONX (hush_utils.h), and -connect=0 does not suppress -addnode. Without
|
||||
# this a regtest node dials the LIVE DragonX network and is fed mainnet headers.
|
||||
# The addnode calls connect_nodes_bi() makes use literal IPs, so they still work.
|
||||
'-dns=0',
|
||||
'-nuparams=5ba81b19:100', # Overwinter
|
||||
'-nuparams=76b809bb:201', # Sapling
|
||||
]] * 3)
|
||||
@@ -69,12 +104,11 @@ class WalletPersistenceTest (BitcoinTestFramework):
|
||||
|
||||
# Verify shielded balance
|
||||
assert_equal(self.nodes[0].z_getbalance(sapling_addr), Decimal('20'))
|
||||
|
||||
|
||||
# Verify size of shielded pools
|
||||
pools = self.nodes[0].getblockchaininfo()['valuePools']
|
||||
assert_equal(pools[0]['chainValue'], Decimal('0')) # Sprout
|
||||
assert_equal(pools[1]['chainValue'], Decimal('20')) # Sapling
|
||||
|
||||
assert_pool_values(pools, Decimal('0'), Decimal('20'))
|
||||
|
||||
# Restart the nodes
|
||||
stop_nodes(self.nodes)
|
||||
wait_bitcoinds()
|
||||
@@ -82,8 +116,7 @@ class WalletPersistenceTest (BitcoinTestFramework):
|
||||
|
||||
# Verify size of shielded pools
|
||||
pools = self.nodes[0].getblockchaininfo()['valuePools']
|
||||
assert_equal(pools[0]['chainValue'], Decimal('0')) # Sprout
|
||||
assert_equal(pools[1]['chainValue'], Decimal('20')) # Sapling
|
||||
assert_pool_values(pools, Decimal('0'), Decimal('20'))
|
||||
|
||||
# Node 0 sends some shielded funds to Node 1
|
||||
dest_addr = self.nodes[1].z_getnewaddress('sapling')
|
||||
|
||||
Reference in New Issue
Block a user