Skip to content

Commit faba4fc

Browse files
author
MarcoFalke
committed
test: Drop 22.x node from TxindexCompatibilityTest
* The node was only used to migrate the legacy txindex. But now that it is known to be working and that 22.x is EOL, it can be dropped. * Also, fix a typo to properly check the txindex of node [1], not [2].
1 parent fa7f65b commit faba4fc

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

test/functional/feature_txindex_compatibility.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
import shutil
1212

1313
from test_framework.test_framework import BitcoinTestFramework
14+
from test_framework.util import assert_raises_rpc_error
1415
from test_framework.wallet import MiniWallet
1516

1617

1718
class TxindexCompatibilityTest(BitcoinTestFramework):
1819
def set_test_params(self):
19-
self.num_nodes = 3
20+
self.num_nodes = 2
2021
self.extra_args = [
2122
["-reindex", "-txindex"],
2223
[],
23-
[],
2424
]
2525

2626
def skip_test_if_missing_module(self):
@@ -33,12 +33,10 @@ def setup_network(self):
3333
versions=[
3434
160300, # Last release with legacy txindex
3535
None, # For MiniWallet, without migration code
36-
220000, # Last release with migration code (0.17.x - 22.x)
3736
],
3837
)
3938
self.start_nodes()
4039
self.connect_nodes(0, 1)
41-
self.connect_nodes(1, 2)
4240

4341
def run_test(self):
4442
mini_wallet = MiniWallet(self.nodes[1])
@@ -47,22 +45,12 @@ def run_test(self):
4745
self.generate(self.nodes[1], 1)
4846

4947
self.log.info("Check legacy txindex")
48+
assert_raises_rpc_error(-5, "Use -txindex", lambda: self.nodes[1].getrawtransaction(txid=spend_utxo["txid"]))
5049
self.nodes[0].getrawtransaction(txid=spend_utxo["txid"]) # Requires -txindex
5150

5251
self.stop_nodes()
5352
legacy_chain_dir = self.nodes[0].chain_path
5453

55-
self.log.info("Migrate legacy txindex")
56-
migrate_chain_dir = self.nodes[2].chain_path
57-
shutil.rmtree(migrate_chain_dir)
58-
shutil.copytree(legacy_chain_dir, migrate_chain_dir)
59-
with self.nodes[2].assert_debug_log([
60-
"Upgrading txindex database...",
61-
"txindex is enabled at height 200",
62-
]):
63-
self.start_node(2, extra_args=["-txindex"])
64-
self.nodes[2].getrawtransaction(txid=spend_utxo["txid"]) # Requires -txindex
65-
6654
self.log.info("Drop legacy txindex")
6755
drop_index_chain_dir = self.nodes[1].chain_path
6856
shutil.rmtree(drop_index_chain_dir)
@@ -73,16 +61,14 @@ def run_test(self):
7361
)
7462
# Build txindex from scratch and check there is no error this time
7563
self.start_node(1, extra_args=["-txindex"])
76-
self.nodes[2].getrawtransaction(txid=spend_utxo["txid"]) # Requires -txindex
64+
self.wait_until(lambda: self.nodes[1].getindexinfo()["txindex"]["synced"] == True)
65+
self.nodes[1].getrawtransaction(txid=spend_utxo["txid"]) # Requires -txindex
7766

7867
self.stop_nodes()
7968

8069
self.log.info("Check migrated txindex cannot be read by legacy node")
8170
err_msg = f": You need to rebuild the database using -reindex to change -txindex.{os.linesep}Please restart with -reindex or -reindex-chainstate to recover."
8271
shutil.rmtree(legacy_chain_dir)
83-
shutil.copytree(migrate_chain_dir, legacy_chain_dir)
84-
self.nodes[0].assert_start_raises_init_error(extra_args=["-txindex"], expected_msg=err_msg)
85-
shutil.rmtree(legacy_chain_dir)
8672
shutil.copytree(drop_index_chain_dir, legacy_chain_dir)
8773
self.nodes[0].assert_start_raises_init_error(extra_args=["-txindex"], expected_msg=err_msg)
8874

0 commit comments

Comments
 (0)