Merge bitcoin/bitcoin#32214: test: Remove fragile and ancient release 0.17 wallet test

fac978fb21 test: Remove fragile and ancient release 0.17 wallet test (MarcoFalke)

Pull request description:

  The test checks that the 0.17 wallet rejects wallet files created in "the future".

  This is nice, and good to know. However,

  * The 0.17 release is ancient and should be unused outside of tests, especially to load future wallets.
  * The test intermittently fails, due to ancient RPC server bugs, that were fixed in the meantime. [1]
  * Albeit they are not identical, the 0.18 release is still checked in this test, so any theoretical bug that would be caught by 0.17 is hopefully still caught by 0.18 as well.

  So fix all issues by removing the test case.

  [1] For example from https://api.cirrus-ci.com/v1/task/6161588714995712/logs/ci.log:

  ```
  190/321 - [1mwallet_backwards_compatibility.py --descriptors[0m failed, Duration: 23 s
  [17:21:40.700]
  [17:21:40.700] [1mstdout:
  [17:21:40.700] [0m2025-04-02T21:21:16.575000Z TestFramework (INFO): PRNG seed is: 5772716217847090743
  [17:21:40.700] 2025-04-02T21:21:16.580000Z TestFramework (INFO): Initializing test directory /ci_container_base/ci/scratch/test_runner/test_runner_₿_🏃_20250402_210134/wallet_backwards_compatibility_134
  [17:21:40.700] 2025-04-02T21:21:26.378000Z TestFramework (INFO): Test wallet backwards compatibility...
  [17:21:40.700] 2025-04-02T21:21:33.191000Z TestFramework (INFO): Testing 0.19 addmultisigaddress case (#18075)
  [17:21:40.700] 2025-04-02T21:21:33.637000Z TestFramework (INFO): Test that a wallet made on master can be opened on:
  [17:21:40.700] 2025-04-02T21:21:33.637000Z TestFramework (INFO): - 250000
  [17:21:40.700] 2025-04-02T21:21:34.055000Z TestFramework (INFO): - 240001
  [17:21:40.700] 2025-04-02T21:21:34.435000Z TestFramework (INFO): - 230000
  [17:21:40.700] 2025-04-02T21:21:34.858000Z TestFramework (INFO): - 220000
  [17:21:40.700] 2025-04-02T21:21:35.614000Z TestFramework (INFO): - 210000
  [17:21:40.700] 2025-04-02T21:21:35.707000Z TestFramework (INFO): Test descriptor wallet incompatibility on:
  [17:21:40.700] 2025-04-02T21:21:35.707000Z TestFramework (INFO): - 200100
  [17:21:40.700] 2025-04-02T21:21:35.878000Z TestFramework (INFO): - 190100
  [17:21:40.700] 2025-04-02T21:21:36.021000Z TestFramework (INFO): - 180100
  [17:21:40.700] 2025-04-02T21:21:36.319000Z TestFramework (INFO): Test descriptor wallet incompatibility with 0.17
  [17:21:40.700] 2025-04-02T21:21:37.328000Z TestFramework (INFO): Test that 0.21 cannot open wallet containing tr() descriptors
  [17:21:40.700] 2025-04-02T21:21:37.356000Z TestFramework (INFO): Test that a wallet can upgrade to and downgrade from master, from:
  [17:21:40.700] 2025-04-02T21:21:37.361000Z TestFramework (INFO): - 250000
  [17:21:40.700] 2025-04-02T21:21:37.665000Z TestFramework (INFO): - 240001
  [17:21:40.700] 2025-04-02T21:21:37.970000Z TestFramework (INFO): - 230000
  [17:21:40.700] 2025-04-02T21:21:38.439000Z TestFramework (INFO): - 220000
  [17:21:40.700] 2025-04-02T21:21:38.793000Z TestFramework (INFO): - 210000
  [17:21:40.700] 2025-04-02T21:21:39.470000Z TestFramework (INFO): Stopping nodes
  [17:21:40.700]
  [17:21:40.700]
  [17:21:40.700] [1mstderr:
  [17:21:40.700] [0mTraceback (most recent call last):
  [17:21:40.700]   File "/ci_container_base/ci/scratch/build-x86_64-pc-linux-gnu/test/functional/wallet_backwards_compatibility.py", line 389, in <module>
  [17:21:40.700]     BackwardsCompatibilityTest(__file__).main()
  [17:21:40.700]   File "/ci_container_base/test/functional/test_framework/test_framework.py", line 206, in main
  [17:21:40.700]     exit_code = self.shutdown()
  [17:21:40.700]   File "/ci_container_base/test/functional/test_framework/test_framework.py", line 379, in shutdown
  [17:21:40.700]     self.stop_nodes()
  [17:21:40.700]   File "/ci_container_base/test/functional/test_framework/test_framework.py", line 643, in stop_nodes
  [17:21:40.700]     node.stop_node(wait=wait, wait_until_stopped=False)
  [17:21:40.700]   File "/ci_container_base/test/functional/test_framework/test_node.py", line 397, in stop_node
  [17:21:40.700]     self.stop()
  [17:21:40.700]   File "/ci_container_base/test/functional/test_framework/coverage.py", line 50, in __call__
  [17:21:40.700]     return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  [17:21:40.700]   File "/ci_container_base/test/functional/test_framework/authproxy.py", line 132, in __call__
  [17:21:40.700]     response, status = self._request('POST', self.__url.path, postdata.encode('utf-8'))
  [17:21:40.700]   File "/ci_container_base/test/functional/test_framework/authproxy.py", line 106, in _request
  [17:21:40.700]     return self._get_response()
  [17:21:40.700]   File "/ci_container_base/test/functional/test_framework/authproxy.py", line 169, in _get_response
  [17:21:40.700]     http_response = self.__conn.getresponse()
  [17:21:40.700]   File "/usr/lib/python3.10/http/client.py", line 1375, in getresponse
  [17:21:40.700]     response.begin()
  [17:21:40.700]   File "/usr/lib/python3.10/http/client.py", line 318, in begin
  [17:21:40.700]     version, status, reason = self._read_status()
  [17:21:40.700]   File "/usr/lib/python3.10/http/client.py", line 287, in _read_status
  [17:21:40.700]     raise RemoteDisconnected("Remote end closed connection without"
  [17:21:40.700] http.client.RemoteDisconnected: Remote end closed connection without response
  [17:21:40.700] [node 10] Cleaning up leftover process
  [17:21:40.700] [node 9] Cleaning up leftover process
  [17:21:40.700] [node 8] Cleaning up leftover process
  [17:21:40.700] [node 7] Cleaning up leftover process
  [17:21:40.700] [node 6] Cleaning up leftover process
  [17:21:40.700] [node 5] Cleaning up leftover process
  [17:21:40.700] [node 4] Cleaning up leftover process
  [17:21:40.700] [node 3] Cleaning up leftover process
  [17:21:40.700] [node 2] Cleaning up leftover process
  [17:21:40.700] [node 1] Cleaning up leftover process
  [17:21:40.700] [node 0] Cleaning up leftover process

ACKs for top commit:
  laanwj:
    Code review ACK fac978fb21
  janb84:
    Re ACK [fac978f](fac978fb21)
  pablomartin4btc:
    re ACK fac978fb21
  BrandonOdiwuor:
    Code Review ACK fac978fb21

Tree-SHA512: 13acdfc6be4293a0ff45ae20b26ba60636e130097da380b7b51716faaa950320462399bef55e74b3cedc82944586dcc1bfd078babb96edb03c4efdb8f40af5a4
This commit is contained in:
Ryan Ofsky 2025-04-08 17:00:50 -04:00
commit ff5b7b0b0a
No known key found for this signature in database
GPG key ID: 46800E30FC748A66

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python3
# Copyright (c) 2018-2022 The Bitcoin Core developers
# Copyright (c) 2018-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Backwards compatibility functional test
@ -33,7 +33,7 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 11
self.num_nodes = 10
# Add new version after each release:
self.extra_args = [
["-addresstype=bech32", "-whitelist=noban@127.0.0.1"], # Pre-release: use to mine blocks. noban for immediate tx relay
@ -46,7 +46,6 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
["-nowallet", "-walletrbf=1", "-addresstype=bech32", "-whitelist=noban@127.0.0.1"], # v0.20.1
["-nowallet", "-walletrbf=1", "-addresstype=bech32", "-whitelist=noban@127.0.0.1"], # v0.19.1
["-nowallet", "-walletrbf=1", "-addresstype=bech32", "-whitelist=127.0.0.1"], # v0.18.1
["-nowallet", "-walletrbf=1", "-addresstype=bech32", "-whitelist=127.0.0.1"], # v0.17.2
]
self.wallet_names = [self.default_wallet_name]
@ -66,7 +65,6 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
200100,
190100,
180100,
170200,
])
self.start_nodes()
@ -97,7 +95,7 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
# See #18075
self.log.info("Testing 0.19 addmultisigaddress case (#18075)")
node_master = self.nodes[1]
node_v19 = self.nodes[self.num_nodes - 4]
node_v19 = self.nodes[self.num_nodes - 3]
node_v19.rpc.createwallet(wallet_name="w1_v19")
wallet = node_v19.get_wallet_rpc("w1_v19")
info = wallet.getwalletinfo()
@ -131,17 +129,17 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
def run_test(self):
node_miner = self.nodes[0]
node_master = self.nodes[1]
node_v21 = self.nodes[self.num_nodes - 5]
node_v17 = self.nodes[self.num_nodes - 1]
node_v21 = self.nodes[self.num_nodes - 4]
node_v18 = self.nodes[self.num_nodes - 1]
legacy_nodes = self.nodes[2:] # Nodes that support legacy wallets
legacy_only_nodes = self.nodes[-4:] # Nodes that only support legacy wallets
descriptors_nodes = self.nodes[2:-4] # Nodes that support descriptor wallets
legacy_only_nodes = self.nodes[-3:] # Nodes that only support legacy wallets
descriptors_nodes = self.nodes[2:-3] # Nodes that support descriptor wallets
self.generatetoaddress(node_miner, COINBASE_MATURITY + 1, node_miner.getnewaddress())
# Sanity check the test framework:
res = node_v17.getblockchaininfo()
res = node_v18.getblockchaininfo()
assert_equal(res['blocks'], COINBASE_MATURITY + 1)
self.log.info("Test wallet backwards compatibility...")
@ -201,10 +199,6 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
for wallet in os.listdir(node_master_wallets_dir):
dest = node.wallets_path / wallet
source = node_master_wallets_dir / wallet
if self.major_version_equals(node, 16):
# 0.16 node expect the wallet to be in the wallet dir but as a plain file rather than in directories
shutil.copyfile(source / "wallet.dat", dest)
else:
shutil.copytree(source, dest)
self.test_v19_addmultisigaddress()
@ -215,9 +209,6 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
for node in descriptors_nodes if self.options.descriptors else legacy_nodes:
self.log.info(f"- {node.version}")
for wallet_name in ["w1", "w2", "w3"]:
if self.major_version_less_than(node, 18) and wallet_name == "w3":
# Blank wallets were introduced in v0.18.0. We test the loading error below.
continue
if self.major_version_less_than(node, 22) and wallet_name == "w1" and self.options.descriptors:
# Descriptor wallets created after 0.21 have taproot descriptors which 0.21 does not support, tested below
continue
@ -261,30 +252,12 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
if self.options.descriptors:
self.log.info("Test descriptor wallet incompatibility on:")
for node in legacy_only_nodes:
# RPC loadwallet failure causes bitcoind to exit in <= 0.17, in addition to the RPC
# call failure, so the following test won't work:
# assert_raises_rpc_error(-4, "Wallet loading failed.", node_v17.loadwallet, 'w3')
if self.major_version_less_than(node, 18):
continue
self.log.info(f"- {node.version}")
# Descriptor wallets appear to be corrupted wallets to old software
assert self.major_version_at_least(node, 18) and self.major_version_less_than(node, 21)
assert self.major_version_less_than(node, 21)
for wallet_name in ["w1", "w2", "w3"]:
assert_raises_rpc_error(-4, "Wallet file verification failed: wallet.dat corrupt, salvage failed", node.loadwallet, wallet_name)
# Instead, we stop node and try to launch it with the wallet:
self.stop_node(node_v17.index)
if self.options.descriptors:
self.log.info("Test descriptor wallet incompatibility with 0.17")
# Descriptor wallets appear to be corrupted wallets to old software
node_v17.assert_start_raises_init_error(["-wallet=w1"], "Error: wallet.dat corrupt, salvage failed")
node_v17.assert_start_raises_init_error(["-wallet=w2"], "Error: wallet.dat corrupt, salvage failed")
node_v17.assert_start_raises_init_error(["-wallet=w3"], "Error: wallet.dat corrupt, salvage failed")
else:
self.log.info("Test blank wallet incompatibility with v17")
node_v17.assert_start_raises_init_error(["-wallet=w3"], "Error: Error loading w3: Wallet requires newer version of Bitcoin Core")
self.start_node(node_v17.index)
# When descriptors are enabled, w1 cannot be opened by 0.21 since it contains a taproot descriptor
if self.options.descriptors:
self.log.info("Test that 0.21 cannot open wallet containing tr() descriptors")
@ -294,13 +267,6 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
for node in descriptors_nodes if self.options.descriptors else legacy_nodes:
self.log.info(f"- {node.version}")
wallet_name = f"up_{node.version}"
if self.major_version_less_than(node, 17):
# createwallet is only available in 0.17+
self.restart_node(node.index, extra_args=[f"-wallet={wallet_name}"])
wallet_prev = node.get_wallet_rpc(wallet_name)
address = wallet_prev.getnewaddress('', "bech32")
addr_info = wallet_prev.validateaddress(address)
else:
if self.major_version_at_least(node, 21):
node.rpc.createwallet(wallet_name=wallet_name, descriptors=self.options.descriptors)
else:
@ -317,10 +283,7 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
wallet_prev.backupwallet(backup_path)
# Remove the wallet from old node
if self.major_version_at_least(node, 17):
wallet_prev.unloadwallet()
else:
self.stop_node(node.index)
# Restore the wallet to master
load_res = node_master.restorewallet(wallet_name, backup_path)
@ -362,18 +325,7 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
wallet.unloadwallet()
# Check that no automatic upgrade broke the downgrading the wallet
if self.major_version_less_than(node, 17):
# loadwallet is only available in 0.17+
shutil.copyfile(
down_backup_path,
node.wallets_path / down_wallet_name
)
self.start_node(node.index, extra_args=[f"-wallet={down_wallet_name}"])
wallet_res = node.get_wallet_rpc(down_wallet_name)
info = wallet_res.validateaddress(address)
assert_equal(info, addr_info)
else:
# Check that no automatic upgrade broke downgrading the wallet
target_dir = node.wallets_path / down_wallet_name
os.makedirs(target_dir, exist_ok=True)
shutil.copyfile(