mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-29 00:08:25 +02:00
Merge bitcoin/bitcoin#28195: blockstorage: Drop legacy -txindex check
fae405556dscripted-diff: Rename CBlockTreeDB -> BlockTreeDB (MarcoFalke)faf63039ccFixup style of moved code (MarcoFalke)fa65111b99move-only: Move CBlockTreeDB to node/blockstorage (MarcoFalke)fa8685597eindex: Drop legacy -txindex check (MarcoFalke)fa69148a0ascripted-diff: Use blocks_path where possible (MarcoFalke) Pull request description: The only reason for the check was to print a warning about an increase in storage use. Now that 22.x is EOL and everyone should have migrated (or decided to not care about storage use), remove the check. Also, a move-only commit is included. (Rebased from https://github.com/bitcoin/bitcoin/pull/22242) ACKs for top commit: TheCharlatan: ACKfae405556d, though I lack historical context to really judge the second commitfa8685597e. stickies-v: ACKfae405556dTree-SHA512: 9da8f48767ae52d8e8e21c09a40c949cc0838794f1856cc5f58a91acd3f00a3bca818c8082242b3fdc9ca5badb09059570bb3870850d3807b75a8e23b5222da1
This commit is contained in:
@@ -18,7 +18,7 @@ class BlocksdirTest(BitcoinTestFramework):
|
||||
|
||||
def run_test(self):
|
||||
self.stop_node(0)
|
||||
assert os.path.isdir(os.path.join(self.nodes[0].chain_path, "blocks"))
|
||||
assert os.path.isdir(os.path.join(self.nodes[0].blocks_path))
|
||||
assert not os.path.isdir(os.path.join(self.nodes[0].datadir, "blocks"))
|
||||
shutil.rmtree(self.nodes[0].datadir)
|
||||
initialize_datadir(self.options.tmpdir, 0, self.chain)
|
||||
@@ -31,7 +31,7 @@ class BlocksdirTest(BitcoinTestFramework):
|
||||
self.log.info("mining blocks..")
|
||||
self.generatetoaddress(self.nodes[0], 10, self.nodes[0].get_deterministic_priv_key().address)
|
||||
assert os.path.isfile(os.path.join(blocksdir_path, self.chain, "blocks", "blk00000.dat"))
|
||||
assert os.path.isdir(os.path.join(self.nodes[0].chain_path, "blocks", "index"))
|
||||
assert os.path.isdir(os.path.join(self.nodes[0].blocks_path, "index"))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -91,7 +91,7 @@ class PruneTest(BitcoinTestFramework):
|
||||
def setup_network(self):
|
||||
self.setup_nodes()
|
||||
|
||||
self.prunedir = os.path.join(self.nodes[2].chain_path, 'blocks', '')
|
||||
self.prunedir = os.path.join(self.nodes[2].blocks_path, '')
|
||||
|
||||
self.connect_nodes(0, 1)
|
||||
self.connect_nodes(1, 2)
|
||||
@@ -290,7 +290,7 @@ class PruneTest(BitcoinTestFramework):
|
||||
assert_equal(ret + 1, node.getblockchaininfo()['pruneheight'])
|
||||
|
||||
def has_block(index):
|
||||
return os.path.isfile(os.path.join(self.nodes[node_number].chain_path, "blocks", f"blk{index:05}.dat"))
|
||||
return os.path.isfile(os.path.join(self.nodes[node_number].blocks_path, f"blk{index:05}.dat"))
|
||||
|
||||
# should not prune because chain tip of node 3 (995) < PruneAfterHeight (1000)
|
||||
assert_raises_rpc_error(-1, "Blockchain is too short for pruning", node.pruneblockchain, height(500))
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
Previous releases are required by this test, see test/README.md.
|
||||
"""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
@@ -55,10 +54,6 @@ class TxindexCompatibilityTest(BitcoinTestFramework):
|
||||
drop_index_chain_dir = self.nodes[1].chain_path
|
||||
shutil.rmtree(drop_index_chain_dir)
|
||||
shutil.copytree(legacy_chain_dir, drop_index_chain_dir)
|
||||
self.nodes[1].assert_start_raises_init_error(
|
||||
extra_args=["-txindex"],
|
||||
expected_msg="Error: The block index db contains a legacy 'txindex'. To clear the occupied disk space, run a full -reindex, otherwise ignore this error. This error message will not be displayed again.",
|
||||
)
|
||||
# Build txindex from scratch and check there is no error this time
|
||||
self.start_node(1, extra_args=["-txindex"])
|
||||
self.wait_until(lambda: self.nodes[1].getindexinfo()["txindex"]["synced"] == True)
|
||||
@@ -66,12 +61,6 @@ class TxindexCompatibilityTest(BitcoinTestFramework):
|
||||
|
||||
self.stop_nodes()
|
||||
|
||||
self.log.info("Check migrated txindex cannot be read by legacy node")
|
||||
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."
|
||||
shutil.rmtree(legacy_chain_dir)
|
||||
shutil.copytree(drop_index_chain_dir, legacy_chain_dir)
|
||||
self.nodes[0].assert_start_raises_init_error(extra_args=["-txindex"], expected_msg=err_msg)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
TxindexCompatibilityTest().main()
|
||||
|
||||
@@ -221,7 +221,7 @@ class WalletBackupTest(BitcoinTestFramework):
|
||||
self.erase_three()
|
||||
|
||||
#start node2 with no chain
|
||||
shutil.rmtree(os.path.join(self.nodes[2].chain_path, 'blocks'))
|
||||
shutil.rmtree(os.path.join(self.nodes[2].blocks_path))
|
||||
shutil.rmtree(os.path.join(self.nodes[2].chain_path, 'chainstate'))
|
||||
|
||||
self.start_three(["-nowallet"])
|
||||
|
||||
@@ -87,7 +87,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
self.stop_node(1)
|
||||
# we need to delete the complete chain directory
|
||||
# otherwise node1 would auto-recover all funds in flag the keypool keys as used
|
||||
shutil.rmtree(os.path.join(self.nodes[1].chain_path, "blocks"))
|
||||
shutil.rmtree(os.path.join(self.nodes[1].blocks_path))
|
||||
shutil.rmtree(os.path.join(self.nodes[1].chain_path, "chainstate"))
|
||||
shutil.copyfile(
|
||||
os.path.join(self.nodes[1].datadir, "hd.bak"),
|
||||
@@ -115,7 +115,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
|
||||
# Try a RPC based rescan
|
||||
self.stop_node(1)
|
||||
shutil.rmtree(os.path.join(self.nodes[1].chain_path, "blocks"))
|
||||
shutil.rmtree(os.path.join(self.nodes[1].blocks_path))
|
||||
shutil.rmtree(os.path.join(self.nodes[1].chain_path, "chainstate"))
|
||||
shutil.copyfile(
|
||||
os.path.join(self.nodes[1].datadir, "hd.bak"),
|
||||
|
||||
@@ -106,7 +106,7 @@ class WalletPruningTest(BitcoinTestFramework):
|
||||
|
||||
def has_block(self, block_index):
|
||||
"""Checks if the pruned node has the specific blk0000*.dat file"""
|
||||
return os.path.isfile(os.path.join(self.nodes[1].chain_path, "blocks", f"blk{block_index:05}.dat"))
|
||||
return os.path.isfile(os.path.join(self.nodes[1].blocks_path, f"blk{block_index:05}.dat"))
|
||||
|
||||
def create_wallet(self, wallet_name, *, unload=False):
|
||||
"""Creates and dumps a wallet on the non-pruned node0 to be later import by the pruned node"""
|
||||
|
||||
Reference in New Issue
Block a user