Skip to content

Commit c456145

Browse files
committed
[test] add 0.19 backwards compatibility tests
1 parent b769cd1 commit c456145

File tree

2 files changed

+71
-4
lines changed

2 files changed

+71
-4
lines changed

ci/test/05_before_script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ if [ -z "$NO_DEPENDS" ]; then
3737
fi
3838
if [ "$TEST_PREVIOUS_RELEASES" = "true" ]; then
3939
BEGIN_FOLD previous-versions
40-
DOCKER_EXEC contrib/devtools/previous_release.sh -b -t "$PREVIOUS_RELEASES_DIR" v0.17.1 v0.18.1
40+
DOCKER_EXEC contrib/devtools/previous_release.sh -b -t "$PREVIOUS_RELEASES_DIR" v0.17.1 v0.18.1 v0.19.0.1
4141
END_FOLD
4242
fi

test/functional/feature_backwards_compatibility.py

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
Test various backwards compatibility scenarios. Download the previous node binaries:
88
9-
contrib/devtools/previous_release.sh -b v0.18.1 v0.17.1
9+
contrib/devtools/previous_release.sh -b v0.19.0.1 v0.18.1 v0.17.1
1010
1111
Due to RPC changes introduced in various versions the below tests
1212
won't work for older versions without some patches or workarounds.
@@ -30,11 +30,12 @@
3030
class BackwardsCompatibilityTest(BitcoinTestFramework):
3131
def set_test_params(self):
3232
self.setup_clean_chain = True
33-
self.num_nodes = 4
33+
self.num_nodes = 5
3434
# Add new version after each release:
3535
self.extra_args = [
3636
["-addresstype=bech32"], # Pre-release: use to mine blocks
3737
["-nowallet", "-walletrbf=1", "-addresstype=bech32"], # Pre-release: use to receive coins, swap wallets, etc
38+
["-nowallet", "-walletrbf=1", "-addresstype=bech32"], # v0.19.0.1
3839
["-nowallet", "-walletrbf=1", "-addresstype=bech32"], # v0.18.1
3940
["-nowallet", "-walletrbf=1", "-addresstype=bech32"] # v0.17.1
4041
]
@@ -52,16 +53,19 @@ def setup_nodes(self):
5253
self.add_nodes(self.num_nodes, extra_args=self.extra_args, versions=[
5354
None,
5455
None,
56+
190000,
5557
180100,
5658
170100
5759
], binary=[
5860
self.options.bitcoind,
5961
self.options.bitcoind,
62+
releases_path + "/v0.19.0.1/bin/bitcoind",
6063
releases_path + "/v0.18.1/bin/bitcoind",
6164
releases_path + "/v0.17.1/bin/bitcoind"
6265
], binary_cli=[
6366
self.options.bitcoincli,
6467
self.options.bitcoincli,
68+
releases_path + "/v0.19.0.1/bin/bitcoin-cli",
6569
releases_path + "/v0.18.1/bin/bitcoin-cli",
6670
releases_path + "/v0.17.1/bin/bitcoin-cli"
6771
])
@@ -77,7 +81,8 @@ def run_test(self):
7781
res = self.nodes[self.num_nodes - 1].getblockchaininfo()
7882
assert_equal(res['blocks'], 101)
7983

80-
node_master = self.nodes[self.num_nodes - 3]
84+
node_master = self.nodes[self.num_nodes - 4]
85+
node_v19 = self.nodes[self.num_nodes - 3]
8186
node_v18 = self.nodes[self.num_nodes - 2]
8287
node_v17 = self.nodes[self.num_nodes - 1]
8388

@@ -111,6 +116,13 @@ def run_test(self):
111116
# Abondon transaction, but don't confirm
112117
self.nodes[1].abandontransaction(tx3_id)
113118

119+
# w1_v19: regular wallet, created with v0.19
120+
node_v19.createwallet(wallet_name="w1_v19")
121+
wallet = node_v19.get_wallet_rpc("w1_v19")
122+
info = wallet.getwalletinfo()
123+
assert info['private_keys_enabled']
124+
assert info['keypoolsize'] > 0
125+
114126
# w1_v18: regular wallet, created with v0.18
115127
node_v18.createwallet(wallet_name="w1_v18")
116128
wallet = node_v18.get_wallet_rpc("w1_v18")
@@ -127,6 +139,13 @@ def run_test(self):
127139
assert info['private_keys_enabled'] == False
128140
assert info['keypoolsize'] == 0
129141

142+
# w2_v19: wallet with private keys disabled, created with v0.19
143+
node_v19.createwallet(wallet_name="w2_v19", disable_private_keys=True)
144+
wallet = node_v19.get_wallet_rpc("w2_v19")
145+
info = wallet.getwalletinfo()
146+
assert info['private_keys_enabled'] == False
147+
assert info['keypoolsize'] == 0
148+
130149
# w2_v18: wallet with private keys disabled, created with v0.18
131150
node_v18.createwallet(wallet_name="w2_v18", disable_private_keys=True)
132151
wallet = node_v18.get_wallet_rpc("w2_v18")
@@ -142,6 +161,13 @@ def run_test(self):
142161
assert info['private_keys_enabled']
143162
assert info['keypoolsize'] == 0
144163

164+
# w3_v19: blank wallet, created with v0.19
165+
node_v19.createwallet(wallet_name="w3_v19", blank=True)
166+
wallet = node_v19.get_wallet_rpc("w3_v19")
167+
info = wallet.getwalletinfo()
168+
assert info['private_keys_enabled']
169+
assert info['keypoolsize'] == 0
170+
145171
# w3_v18: blank wallet, created with v0.18
146172
node_v18.createwallet(wallet_name="w3_v18", blank=True)
147173
wallet = node_v18.get_wallet_rpc("w3_v18")
@@ -151,10 +177,13 @@ def run_test(self):
151177

152178
# Copy the wallets to older nodes:
153179
node_master_wallets_dir = os.path.join(node_master.datadir, "regtest/wallets")
180+
node_v19_wallets_dir = os.path.join(node_v19.datadir, "regtest/wallets")
154181
node_v18_wallets_dir = os.path.join(node_v18.datadir, "regtest/wallets")
155182
node_v17_wallets_dir = os.path.join(node_v17.datadir, "regtest/wallets")
156183
node_master.unloadwallet("w1")
157184
node_master.unloadwallet("w2")
185+
node_v19.unloadwallet("w1_v19")
186+
node_v19.unloadwallet("w2_v19")
158187
node_v18.unloadwallet("w1_v18")
159188
node_v18.unloadwallet("w2_v18")
160189

@@ -177,6 +206,44 @@ def run_test(self):
177206
os.path.join(node_v18_wallets_dir, wallet)
178207
)
179208

209+
# Copy wallets to v0.19
210+
for wallet in os.listdir(node_master_wallets_dir):
211+
shutil.copytree(
212+
os.path.join(node_master_wallets_dir, wallet),
213+
os.path.join(node_v19_wallets_dir, wallet)
214+
)
215+
216+
# Open the wallets in v0.19
217+
node_v19.loadwallet("w1")
218+
wallet = node_v19.get_wallet_rpc("w1")
219+
info = wallet.getwalletinfo()
220+
assert info['private_keys_enabled']
221+
assert info['keypoolsize'] > 0
222+
txs = wallet.listtransactions()
223+
assert_equal(len(txs), 5)
224+
assert_equal(txs[1]["txid"], tx1_id)
225+
assert_equal(txs[2]["walletconflicts"], [tx1_id])
226+
assert_equal(txs[1]["replaced_by_txid"], tx2_id)
227+
assert not(txs[1]["abandoned"])
228+
assert_equal(txs[1]["confirmations"], -1)
229+
assert_equal(txs[2]["blockindex"], 1)
230+
assert txs[3]["abandoned"]
231+
assert_equal(txs[4]["walletconflicts"], [tx3_id])
232+
assert_equal(txs[3]["replaced_by_txid"], tx4_id)
233+
assert not(hasattr(txs[3], "blockindex"))
234+
235+
node_v19.loadwallet("w2")
236+
wallet = node_v19.get_wallet_rpc("w2")
237+
info = wallet.getwalletinfo()
238+
assert info['private_keys_enabled'] == False
239+
assert info['keypoolsize'] == 0
240+
241+
node_v19.loadwallet("w3")
242+
wallet = node_v19.get_wallet_rpc("w3")
243+
info = wallet.getwalletinfo()
244+
assert info['private_keys_enabled']
245+
assert info['keypoolsize'] == 0
246+
180247
# Open the wallets in v0.18
181248
node_v18.loadwallet("w1")
182249
wallet = node_v18.get_wallet_rpc("w1")

0 commit comments

Comments
 (0)