test: Run downgrade test on descriptor wallets
This commit is contained in:
1 parent
f158573be1
commit
6d4699028b
1 file changed
+26
-16
@@ -135,7 +135,9 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
|||||||
node_v17 = self.nodes[self.num_nodes - 2]
|
node_v17 = self.nodes[self.num_nodes - 2]
|
||||||
node_v16 = self.nodes[self.num_nodes - 1]
|
node_v16 = self.nodes[self.num_nodes - 1]
|
||||||
|
|
||||||
legacy_nodes = self.nodes[2:]
|
legacy_nodes = self.nodes[2:] # Nodes that support legacy wallets
|
||||||
|
legacy_only_nodes = self.nodes[-5:] # Nodes that only support legacy wallets
|
||||||
|
descriptors_nodes = self.nodes[2:-5] # Nodes that support descriptor wallets
|
||||||
|
|
||||||
self.generatetoaddress(node_miner, COINBASE_MATURITY + 1, node_miner.getnewaddress())
|
self.generatetoaddress(node_miner, COINBASE_MATURITY + 1, node_miner.getnewaddress())
|
||||||
|
|
||||||
@@ -209,17 +211,21 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
self.test_v19_addmultisigaddress()
|
self.test_v19_addmultisigaddress()
|
||||||
|
|
||||||
if not self.options.descriptors:
|
self.log.info("Test that a wallet made on master can be opened on:")
|
||||||
# Descriptor wallets break compatibility, only run this test for legacy wallet
|
# In descriptors wallet mode, run this test on the nodes that support descriptor wallets
|
||||||
# Load modern wallet with older nodes
|
# In legacy wallets mode, run this test on the nodes that support legacy wallets
|
||||||
for node in legacy_nodes:
|
for node in descriptors_nodes if self.options.descriptors else legacy_nodes:
|
||||||
for wallet_name in ["w1", "w2", "w3"]:
|
if self.major_version_less_than(node, 17):
|
||||||
if node.version < 170000:
|
|
||||||
# loadwallet was introduced in v0.17.0
|
# loadwallet was introduced in v0.17.0
|
||||||
continue
|
continue
|
||||||
if node.version < 180000 and wallet_name == "w3":
|
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.
|
# Blank wallets were introduced in v0.18.0. We test the loading error below.
|
||||||
continue
|
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
|
||||||
node.loadwallet(wallet_name)
|
node.loadwallet(wallet_name)
|
||||||
wallet = node.get_wallet_rpc(wallet_name)
|
wallet = node.get_wallet_rpc(wallet_name)
|
||||||
info = wallet.getwalletinfo()
|
info = wallet.getwalletinfo()
|
||||||
@@ -244,17 +250,21 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
|||||||
else:
|
else:
|
||||||
assert info['private_keys_enabled'] == True
|
assert info['private_keys_enabled'] == True
|
||||||
assert info['keypoolsize'] == 0
|
assert info['keypoolsize'] == 0
|
||||||
else:
|
|
||||||
for node in legacy_nodes:
|
|
||||||
# Descriptor wallets appear to be corrupted wallets to old software
|
|
||||||
# and loadwallet is introduced in v0.17.0
|
|
||||||
if node.version >= 170000 and node.version < 210000:
|
|
||||||
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)
|
|
||||||
|
|
||||||
# RPC loadwallet failure causes bitcoind to exit, in addition to the RPC
|
# Check that descriptor wallets don't work on legacy only nodes
|
||||||
|
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:
|
# call failure, so the following test won't work:
|
||||||
# assert_raises_rpc_error(-4, "Wallet loading failed.", node_v17.loadwallet, 'w3')
|
# 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)
|
||||||
|
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:
|
# Instead, we stop node and try to launch it with the wallet:
|
||||||
self.stop_node(node_v17.index)
|
self.stop_node(node_v17.index)
|
||||||
|
|||||||
Reference in new issue
Block a user