mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 18:09:47 +01:00
scripted-diff: Use blocks_path where possible
-BEGIN VERIFY SCRIPT- sed -i 's|].chain_path / "blocks"|].blocks_path|g' $(git grep -l chain_path) -END VERIFY SCRIPT-
This commit is contained in:
parent
fa060c15fb
commit
fafe43cb6c
@ -25,7 +25,7 @@ class AbortNodeTest(BitcoinTestFramework):
|
|||||||
self.generate(self.nodes[0], 3, sync_fun=self.no_op)
|
self.generate(self.nodes[0], 3, sync_fun=self.no_op)
|
||||||
|
|
||||||
# Deleting the undo file will result in reorg failure
|
# Deleting the undo file will result in reorg failure
|
||||||
(self.nodes[0].chain_path / "blocks" / "rev00000.dat").unlink()
|
(self.nodes[0].blocks_path / "rev00000.dat").unlink()
|
||||||
|
|
||||||
# Connecting to a node with a more work chain will trigger a reorg
|
# Connecting to a node with a more work chain will trigger a reorg
|
||||||
# attempt.
|
# attempt.
|
||||||
|
@ -26,7 +26,7 @@ class SymlinkTest(BitcoinTestFramework):
|
|||||||
self.stop_node(0)
|
self.stop_node(0)
|
||||||
|
|
||||||
rename_and_link(
|
rename_and_link(
|
||||||
from_name=self.nodes[0].chain_path / "blocks",
|
from_name=self.nodes[0].blocks_path,
|
||||||
to_name=dir_new_blocks,
|
to_name=dir_new_blocks,
|
||||||
)
|
)
|
||||||
rename_and_link(
|
rename_and_link(
|
||||||
|
@ -37,7 +37,7 @@ class LoadblockTest(BitcoinTestFramework):
|
|||||||
cfg_file = os.path.join(data_dir, "linearize.cfg")
|
cfg_file = os.path.join(data_dir, "linearize.cfg")
|
||||||
bootstrap_file = os.path.join(self.options.tmpdir, "bootstrap.dat")
|
bootstrap_file = os.path.join(self.options.tmpdir, "bootstrap.dat")
|
||||||
genesis_block = self.nodes[0].getblockhash(0)
|
genesis_block = self.nodes[0].getblockhash(0)
|
||||||
blocks_dir = self.nodes[0].chain_path / "blocks"
|
blocks_dir = self.nodes[0].blocks_path
|
||||||
hash_list = tempfile.NamedTemporaryFile(dir=data_dir,
|
hash_list = tempfile.NamedTemporaryFile(dir=data_dir,
|
||||||
mode='w',
|
mode='w',
|
||||||
delete=False,
|
delete=False,
|
||||||
|
@ -38,7 +38,7 @@ class ReindexTest(BitcoinTestFramework):
|
|||||||
# In this test environment, blocks will always be in order (since
|
# In this test environment, blocks will always be in order (since
|
||||||
# we're generating them rather than getting them from peers), so to
|
# we're generating them rather than getting them from peers), so to
|
||||||
# test out-of-order handling, swap blocks 1 and 2 on disk.
|
# test out-of-order handling, swap blocks 1 and 2 on disk.
|
||||||
blk0 = self.nodes[0].chain_path / "blocks" / "blk00000.dat"
|
blk0 = self.nodes[0].blocks_path / "blk00000.dat"
|
||||||
with open(blk0, 'r+b') as bf:
|
with open(blk0, 'r+b') as bf:
|
||||||
# Read at least the first few blocks (including genesis)
|
# Read at least the first few blocks (including genesis)
|
||||||
b = bf.read(2000)
|
b = bf.read(2000)
|
||||||
|
@ -20,10 +20,10 @@ class FeatureRemovePrunedFilesOnStartupTest(BitcoinTestFramework):
|
|||||||
self.sync_blocks()
|
self.sync_blocks()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
blk0 = self.nodes[0].chain_path / "blocks" / "blk00000.dat"
|
blk0 = self.nodes[0].blocks_path / "blk00000.dat"
|
||||||
rev0 = self.nodes[0].chain_path / "blocks" / "rev00000.dat"
|
rev0 = self.nodes[0].blocks_path / "rev00000.dat"
|
||||||
blk1 = self.nodes[0].chain_path / "blocks" / "blk00001.dat"
|
blk1 = self.nodes[0].blocks_path / "blk00001.dat"
|
||||||
rev1 = self.nodes[0].chain_path / "blocks" / "rev00001.dat"
|
rev1 = self.nodes[0].blocks_path / "rev00001.dat"
|
||||||
self.mine_batches(800)
|
self.mine_batches(800)
|
||||||
fo1 = os.open(blk0, os.O_RDONLY)
|
fo1 = os.open(blk0, os.O_RDONLY)
|
||||||
fo2 = os.open(rev1, os.O_RDONLY)
|
fo2 = os.open(rev1, os.O_RDONLY)
|
||||||
|
@ -40,9 +40,9 @@ class UnsupportedUtxoDbTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
self.log.info("Check init error")
|
self.log.info("Check init error")
|
||||||
legacy_utxos_dir = self.nodes[0].chain_path / "chainstate"
|
legacy_utxos_dir = self.nodes[0].chain_path / "chainstate"
|
||||||
legacy_blocks_dir = self.nodes[0].chain_path / "blocks"
|
legacy_blocks_dir = self.nodes[0].blocks_path
|
||||||
recent_utxos_dir = self.nodes[1].chain_path / "chainstate"
|
recent_utxos_dir = self.nodes[1].chain_path / "chainstate"
|
||||||
recent_blocks_dir = self.nodes[1].chain_path / "blocks"
|
recent_blocks_dir = self.nodes[1].blocks_path
|
||||||
shutil.copytree(legacy_utxos_dir, recent_utxos_dir)
|
shutil.copytree(legacy_utxos_dir, recent_utxos_dir)
|
||||||
shutil.copytree(legacy_blocks_dir, recent_blocks_dir)
|
shutil.copytree(legacy_blocks_dir, recent_blocks_dir)
|
||||||
self.nodes[1].assert_start_raises_init_error(
|
self.nodes[1].assert_start_raises_init_error(
|
||||||
|
@ -577,8 +577,8 @@ class BlockchainTest(BitcoinTestFramework):
|
|||||||
self.log.info("Test that getblock with verbosity 2 and 3 still works with pruned Undo data")
|
self.log.info("Test that getblock with verbosity 2 and 3 still works with pruned Undo data")
|
||||||
|
|
||||||
def move_block_file(old, new):
|
def move_block_file(old, new):
|
||||||
old_path = self.nodes[0].chain_path / "blocks" / old
|
old_path = self.nodes[0].blocks_path / old
|
||||||
new_path = self.nodes[0].chain_path / "blocks" / new
|
new_path = self.nodes[0].blocks_path / new
|
||||||
old_path.rename(new_path)
|
old_path.rename(new_path)
|
||||||
|
|
||||||
# Move instead of deleting so we can restore chain state afterwards
|
# Move instead of deleting so we can restore chain state afterwards
|
||||||
|
Loading…
Reference in New Issue
Block a user