Skip to content

Commit 2e6a16b

Browse files
author
MarcoFalke
committed
Merge #18855: tests: feature_backwards_compatibility.py test downgrade after upgrade
489ebfd tests: feature_backwards_compatibility.py test downgrade after upgrade (Andrew Chow) Pull request description: After upgrading the node, try to go back to the original version to make sure that using a newer node version does not prevent the wallet file from being downgraded again. ACKs for top commit: MarcoFalke: ACK 489ebfd Tree-SHA512: 86231de6514b3657912fd9d6621212166fd2b29b591fc97120092c548babcf1d6f50b5bd103b28cecde395a26809134f01c1a198725596c3626420de3fd1f017
2 parents cce034b + 489ebfd commit 2e6a16b

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

test/functional/feature_backwards_compatibility.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,9 @@ def run_test(self):
302302
node_v17.rpc.createwallet(wallet_name="u1_v17")
303303
wallet = node_v17.get_wallet_rpc("u1_v17")
304304
address = wallet.getnewaddress("bech32")
305-
info = wallet.getaddressinfo(address)
306-
hdkeypath = info["hdkeypath"]
307-
pubkey = info["pubkey"]
305+
v17_info = wallet.getaddressinfo(address)
306+
hdkeypath = v17_info["hdkeypath"]
307+
pubkey = v17_info["pubkey"]
308308

309309
# Copy the 0.17 wallet to the last Bitcoin Core version and open it:
310310
node_v17.unloadwallet("u1_v17")
@@ -318,6 +318,18 @@ def run_test(self):
318318
descriptor = "wpkh([" + info["hdmasterfingerprint"] + hdkeypath[1:] + "]" + pubkey + ")"
319319
assert_equal(info["desc"], descsum_create(descriptor))
320320

321+
# Now copy that same wallet back to 0.17 to make sure no automatic upgrade breaks it
322+
node_master.unloadwallet("u1_v17")
323+
shutil.rmtree(os.path.join(node_v17_wallets_dir, "u1_v17"))
324+
shutil.copytree(
325+
os.path.join(node_master_wallets_dir, "u1_v17"),
326+
os.path.join(node_v17_wallets_dir, "u1_v17")
327+
)
328+
node_v17.loadwallet("u1_v17")
329+
wallet = node_v17.get_wallet_rpc("u1_v17")
330+
info = wallet.getaddressinfo(address)
331+
assert_equal(info, v17_info)
332+
321333
# Copy the 0.19 wallet to the last Bitcoin Core version and open it:
322334
shutil.copytree(
323335
os.path.join(node_v19_wallets_dir, "w1_v19"),
@@ -327,5 +339,16 @@ def run_test(self):
327339
wallet = node_master.get_wallet_rpc("w1_v19")
328340
assert wallet.getaddressinfo(address_18075)["solvable"]
329341

342+
# Now copy that same wallet back to 0.19 to make sure no automatic upgrade breaks it
343+
node_master.unloadwallet("w1_v19")
344+
shutil.rmtree(os.path.join(node_v19_wallets_dir, "w1_v19"))
345+
shutil.copytree(
346+
os.path.join(node_master_wallets_dir, "w1_v19"),
347+
os.path.join(node_v19_wallets_dir, "w1_v19")
348+
)
349+
node_v19.loadwallet("w1_v19")
350+
wallet = node_v19.get_wallet_rpc("w1_v19")
351+
assert wallet.getaddressinfo(address_18075)["solvable"]
352+
330353
if __name__ == '__main__':
331354
BackwardsCompatibilityTest().main()

0 commit comments

Comments
 (0)