Skip to content

Commit c8176f7

Browse files
committed
test: add blocks_key_path
Adds a convenience function to TestNode to provide the path to the blocks xor key. Updates util and feature_blocksxor to use it.
1 parent d79ea80 commit c8176f7

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

test/functional/feature_blocksxor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def run_test(self):
5454
match=ErrorMatch.PARTIAL_REGEX)
5555

5656
self.log.info("Delete XOR key, restart node with '-blocksxor=0', check blk*.dat/rev*.dat file integrity")
57-
os.remove(node.blocks_path / 'xor.dat')
57+
os.remove(node.blocks_key_path)
5858
self.start_node(0, extra_args=['-blocksxor=0'])
5959
# checklevel=2 -> verify block validity + undo data
6060
# nblocks=0 -> verify all blocks

test/functional/test_framework/test_node.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,10 @@ def debug_log_path(self) -> Path:
465465
def blocks_path(self) -> Path:
466466
return self.chain_path / "blocks"
467467

468+
@property
469+
def blocks_key_path(self) -> Path:
470+
return self.blocks_path / "xor.dat"
471+
468472
@property
469473
def wallets_path(self) -> Path:
470474
return self.chain_path / "wallets"

test/functional/test_framework/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def check_node_connections(*, node, num_in, num_out):
516516

517517

518518
def read_xor_key(*, node):
519-
with open(node.blocks_path / "xor.dat", "rb") as xor_f:
519+
with open(node.blocks_key_path, "rb") as xor_f:
520520
NUM_XOR_BYTES = 8 # From InitBlocksdirXorKey::xor_key.size()
521521
return xor_f.read(NUM_XOR_BYTES)
522522

0 commit comments

Comments
 (0)