[test] add 0.19 backwards compatibility tests
This commit is contained in:
parent
b769cd142d
commit
c456145b2c
2 changed files with 71 additions and 4 deletions
|
@ -37,6 +37,6 @@ if [ -z "$NO_DEPENDS" ]; then
|
||||||
fi
|
fi
|
||||||
if [ "$TEST_PREVIOUS_RELEASES" = "true" ]; then
|
if [ "$TEST_PREVIOUS_RELEASES" = "true" ]; then
|
||||||
BEGIN_FOLD previous-versions
|
BEGIN_FOLD previous-versions
|
||||||
DOCKER_EXEC contrib/devtools/previous_release.sh -b -t "$PREVIOUS_RELEASES_DIR" v0.17.1 v0.18.1
|
DOCKER_EXEC contrib/devtools/previous_release.sh -b -t "$PREVIOUS_RELEASES_DIR" v0.17.1 v0.18.1 v0.19.0.1
|
||||||
END_FOLD
|
END_FOLD
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
Test various backwards compatibility scenarios. Download the previous node binaries:
|
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
|
Due to RPC changes introduced in various versions the below tests
|
||||||
won't work for older versions without some patches or workarounds.
|
won't work for older versions without some patches or workarounds.
|
||||||
|
@ -30,11 +30,12 @@ from test_framework.util import (
|
||||||
class BackwardsCompatibilityTest(BitcoinTestFramework):
|
class BackwardsCompatibilityTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 4
|
self.num_nodes = 5
|
||||||
# Add new version after each release:
|
# Add new version after each release:
|
||||||
self.extra_args = [
|
self.extra_args = [
|
||||||
["-addresstype=bech32"], # Pre-release: use to mine blocks
|
["-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"], # 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.18.1
|
||||||
["-nowallet", "-walletrbf=1", "-addresstype=bech32"] # v0.17.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=[
|
self.add_nodes(self.num_nodes, extra_args=self.extra_args, versions=[
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
190000,
|
||||||
180100,
|
180100,
|
||||||
170100
|
170100
|
||||||
], binary=[
|
], binary=[
|
||||||
self.options.bitcoind,
|
self.options.bitcoind,
|
||||||
self.options.bitcoind,
|
self.options.bitcoind,
|
||||||
|
releases_path + "/v0.19.0.1/bin/bitcoind",
|
||||||
releases_path + "/v0.18.1/bin/bitcoind",
|
releases_path + "/v0.18.1/bin/bitcoind",
|
||||||
releases_path + "/v0.17.1/bin/bitcoind"
|
releases_path + "/v0.17.1/bin/bitcoind"
|
||||||
], binary_cli=[
|
], binary_cli=[
|
||||||
self.options.bitcoincli,
|
self.options.bitcoincli,
|
||||||
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.18.1/bin/bitcoin-cli",
|
||||||
releases_path + "/v0.17.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()
|
res = self.nodes[self.num_nodes - 1].getblockchaininfo()
|
||||||
assert_equal(res['blocks'], 101)
|
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_v18 = self.nodes[self.num_nodes - 2]
|
||||||
node_v17 = self.nodes[self.num_nodes - 1]
|
node_v17 = self.nodes[self.num_nodes - 1]
|
||||||
|
|
||||||
|
@ -111,6 +116,13 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
||||||
# Abondon transaction, but don't confirm
|
# Abondon transaction, but don't confirm
|
||||||
self.nodes[1].abandontransaction(tx3_id)
|
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
|
# w1_v18: regular wallet, created with v0.18
|
||||||
node_v18.createwallet(wallet_name="w1_v18")
|
node_v18.createwallet(wallet_name="w1_v18")
|
||||||
wallet = node_v18.get_wallet_rpc("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['private_keys_enabled'] == False
|
||||||
assert info['keypoolsize'] == 0
|
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
|
# w2_v18: wallet with private keys disabled, created with v0.18
|
||||||
node_v18.createwallet(wallet_name="w2_v18", disable_private_keys=True)
|
node_v18.createwallet(wallet_name="w2_v18", disable_private_keys=True)
|
||||||
wallet = node_v18.get_wallet_rpc("w2_v18")
|
wallet = node_v18.get_wallet_rpc("w2_v18")
|
||||||
|
@ -142,6 +161,13 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
||||||
assert info['private_keys_enabled']
|
assert info['private_keys_enabled']
|
||||||
assert info['keypoolsize'] == 0
|
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
|
# w3_v18: blank wallet, created with v0.18
|
||||||
node_v18.createwallet(wallet_name="w3_v18", blank=True)
|
node_v18.createwallet(wallet_name="w3_v18", blank=True)
|
||||||
wallet = node_v18.get_wallet_rpc("w3_v18")
|
wallet = node_v18.get_wallet_rpc("w3_v18")
|
||||||
|
@ -151,10 +177,13 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
||||||
|
|
||||||
# Copy the wallets to older nodes:
|
# Copy the wallets to older nodes:
|
||||||
node_master_wallets_dir = os.path.join(node_master.datadir, "regtest/wallets")
|
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_v18_wallets_dir = os.path.join(node_v18.datadir, "regtest/wallets")
|
||||||
node_v17_wallets_dir = os.path.join(node_v17.datadir, "regtest/wallets")
|
node_v17_wallets_dir = os.path.join(node_v17.datadir, "regtest/wallets")
|
||||||
node_master.unloadwallet("w1")
|
node_master.unloadwallet("w1")
|
||||||
node_master.unloadwallet("w2")
|
node_master.unloadwallet("w2")
|
||||||
|
node_v19.unloadwallet("w1_v19")
|
||||||
|
node_v19.unloadwallet("w2_v19")
|
||||||
node_v18.unloadwallet("w1_v18")
|
node_v18.unloadwallet("w1_v18")
|
||||||
node_v18.unloadwallet("w2_v18")
|
node_v18.unloadwallet("w2_v18")
|
||||||
|
|
||||||
|
@ -177,6 +206,44 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
||||||
os.path.join(node_v18_wallets_dir, wallet)
|
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
|
# Open the wallets in v0.18
|
||||||
node_v18.loadwallet("w1")
|
node_v18.loadwallet("w1")
|
||||||
wallet = node_v18.get_wallet_rpc("w1")
|
wallet = node_v18.get_wallet_rpc("w1")
|
||||||
|
|
Loading…
Reference in a new issue