diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2019-10-09 21:10:37 +0200 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2020-02-11 21:46:23 +0100 |
commit | c456145b2c65f580683df03bf10cd39000cf24d5 (patch) | |
tree | 8509dcb4d5927864ea8f8041a720fcdc4a84c15f /test/functional/feature_backwards_compatibility.py | |
parent | b769cd142deda74fe46e231cc7b687a86514f2f1 (diff) |
[test] add 0.19 backwards compatibility tests
Diffstat (limited to 'test/functional/feature_backwards_compatibility.py')
-rwxr-xr-x | test/functional/feature_backwards_compatibility.py | 73 |
1 files changed, 70 insertions, 3 deletions
diff --git a/test/functional/feature_backwards_compatibility.py b/test/functional/feature_backwards_compatibility.py index 6304c285fe..1ac10f971a 100755 --- a/test/functional/feature_backwards_compatibility.py +++ b/test/functional/feature_backwards_compatibility.py @@ -6,7 +6,7 @@ Test various backwards compatibility scenarios. Download the previous node binaries: -contrib/devtools/previous_release.sh -b v0.18.1 v0.17.1 +contrib/devtools/previous_release.sh -b v0.19.0.1 v0.18.1 v0.17.1 Due to RPC changes introduced in various versions the below tests won't work for older versions without some patches or workarounds. @@ -30,11 +30,12 @@ from test_framework.util import ( class BackwardsCompatibilityTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True - self.num_nodes = 4 + self.num_nodes = 5 # Add new version after each release: self.extra_args = [ ["-addresstype=bech32"], # Pre-release: use to mine blocks ["-nowallet", "-walletrbf=1", "-addresstype=bech32"], # Pre-release: use to receive coins, swap wallets, etc + ["-nowallet", "-walletrbf=1", "-addresstype=bech32"], # v0.19.0.1 ["-nowallet", "-walletrbf=1", "-addresstype=bech32"], # v0.18.1 ["-nowallet", "-walletrbf=1", "-addresstype=bech32"] # v0.17.1 ] @@ -52,16 +53,19 @@ class BackwardsCompatibilityTest(BitcoinTestFramework): self.add_nodes(self.num_nodes, extra_args=self.extra_args, versions=[ None, None, + 190000, 180100, 170100 ], binary=[ self.options.bitcoind, self.options.bitcoind, + releases_path + "/v0.19.0.1/bin/bitcoind", releases_path + "/v0.18.1/bin/bitcoind", releases_path + "/v0.17.1/bin/bitcoind" ], binary_cli=[ self.options.bitcoincli, self.options.bitcoincli, + releases_path + "/v0.19.0.1/bin/bitcoin-cli", releases_path + "/v0.18.1/bin/bitcoin-cli", releases_path + "/v0.17.1/bin/bitcoin-cli" ]) @@ -77,7 +81,8 @@ class BackwardsCompatibilityTest(BitcoinTestFramework): res = self.nodes[self.num_nodes - 1].getblockchaininfo() assert_equal(res['blocks'], 101) - node_master = self.nodes[self.num_nodes - 3] + node_master = self.nodes[self.num_nodes - 4] + node_v19 = self.nodes[self.num_nodes - 3] node_v18 = self.nodes[self.num_nodes - 2] node_v17 = self.nodes[self.num_nodes - 1] @@ -111,6 +116,13 @@ class BackwardsCompatibilityTest(BitcoinTestFramework): # Abondon transaction, but don't confirm self.nodes[1].abandontransaction(tx3_id) + # w1_v19: regular wallet, created with v0.19 + node_v19.createwallet(wallet_name="w1_v19") + wallet = node_v19.get_wallet_rpc("w1_v19") + info = wallet.getwalletinfo() + assert info['private_keys_enabled'] + assert info['keypoolsize'] > 0 + # w1_v18: regular wallet, created with v0.18 node_v18.createwallet(wallet_name="w1_v18") wallet = node_v18.get_wallet_rpc("w1_v18") @@ -127,6 +139,13 @@ class BackwardsCompatibilityTest(BitcoinTestFramework): assert info['private_keys_enabled'] == False assert info['keypoolsize'] == 0 + # w2_v19: wallet with private keys disabled, created with v0.19 + node_v19.createwallet(wallet_name="w2_v19", disable_private_keys=True) + wallet = node_v19.get_wallet_rpc("w2_v19") + info = wallet.getwalletinfo() + assert info['private_keys_enabled'] == False + assert info['keypoolsize'] == 0 + # w2_v18: wallet with private keys disabled, created with v0.18 node_v18.createwallet(wallet_name="w2_v18", disable_private_keys=True) wallet = node_v18.get_wallet_rpc("w2_v18") @@ -142,6 +161,13 @@ class BackwardsCompatibilityTest(BitcoinTestFramework): assert info['private_keys_enabled'] assert info['keypoolsize'] == 0 + # w3_v19: blank wallet, created with v0.19 + node_v19.createwallet(wallet_name="w3_v19", blank=True) + wallet = node_v19.get_wallet_rpc("w3_v19") + info = wallet.getwalletinfo() + assert info['private_keys_enabled'] + assert info['keypoolsize'] == 0 + # w3_v18: blank wallet, created with v0.18 node_v18.createwallet(wallet_name="w3_v18", blank=True) wallet = node_v18.get_wallet_rpc("w3_v18") @@ -151,10 +177,13 @@ class BackwardsCompatibilityTest(BitcoinTestFramework): # Copy the wallets to older nodes: node_master_wallets_dir = os.path.join(node_master.datadir, "regtest/wallets") + node_v19_wallets_dir = os.path.join(node_v19.datadir, "regtest/wallets") node_v18_wallets_dir = os.path.join(node_v18.datadir, "regtest/wallets") node_v17_wallets_dir = os.path.join(node_v17.datadir, "regtest/wallets") node_master.unloadwallet("w1") node_master.unloadwallet("w2") + node_v19.unloadwallet("w1_v19") + node_v19.unloadwallet("w2_v19") node_v18.unloadwallet("w1_v18") node_v18.unloadwallet("w2_v18") @@ -177,6 +206,44 @@ class BackwardsCompatibilityTest(BitcoinTestFramework): os.path.join(node_v18_wallets_dir, wallet) ) + # Copy wallets to v0.19 + for wallet in os.listdir(node_master_wallets_dir): + shutil.copytree( + os.path.join(node_master_wallets_dir, wallet), + os.path.join(node_v19_wallets_dir, wallet) + ) + + # Open the wallets in v0.19 + node_v19.loadwallet("w1") + wallet = node_v19.get_wallet_rpc("w1") + info = wallet.getwalletinfo() + assert info['private_keys_enabled'] + assert info['keypoolsize'] > 0 + txs = wallet.listtransactions() + assert_equal(len(txs), 5) + assert_equal(txs[1]["txid"], tx1_id) + assert_equal(txs[2]["walletconflicts"], [tx1_id]) + assert_equal(txs[1]["replaced_by_txid"], tx2_id) + assert not(txs[1]["abandoned"]) + assert_equal(txs[1]["confirmations"], -1) + assert_equal(txs[2]["blockindex"], 1) + assert txs[3]["abandoned"] + assert_equal(txs[4]["walletconflicts"], [tx3_id]) + assert_equal(txs[3]["replaced_by_txid"], tx4_id) + assert not(hasattr(txs[3], "blockindex")) + + node_v19.loadwallet("w2") + wallet = node_v19.get_wallet_rpc("w2") + info = wallet.getwalletinfo() + assert info['private_keys_enabled'] == False + assert info['keypoolsize'] == 0 + + node_v19.loadwallet("w3") + wallet = node_v19.get_wallet_rpc("w3") + info = wallet.getwalletinfo() + assert info['private_keys_enabled'] + assert info['keypoolsize'] == 0 + # Open the wallets in v0.18 node_v18.loadwallet("w1") wallet = node_v18.get_wallet_rpc("w1") |