mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-21 01:11:43 +02:00
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.
This commit is contained in:
parent
d79ea809d2
commit
c8176f758b
@ -54,7 +54,7 @@ class BlocksXORTest(BitcoinTestFramework):
|
||||
match=ErrorMatch.PARTIAL_REGEX)
|
||||
|
||||
self.log.info("Delete XOR key, restart node with '-blocksxor=0', check blk*.dat/rev*.dat file integrity")
|
||||
os.remove(node.blocks_path / 'xor.dat')
|
||||
os.remove(node.blocks_key_path)
|
||||
self.start_node(0, extra_args=['-blocksxor=0'])
|
||||
# checklevel=2 -> verify block validity + undo data
|
||||
# nblocks=0 -> verify all blocks
|
||||
|
@ -465,6 +465,10 @@ class TestNode():
|
||||
def blocks_path(self) -> Path:
|
||||
return self.chain_path / "blocks"
|
||||
|
||||
@property
|
||||
def blocks_key_path(self) -> Path:
|
||||
return self.blocks_path / "xor.dat"
|
||||
|
||||
@property
|
||||
def wallets_path(self) -> Path:
|
||||
return self.chain_path / "wallets"
|
||||
|
@ -516,7 +516,7 @@ def check_node_connections(*, node, num_in, num_out):
|
||||
|
||||
|
||||
def read_xor_key(*, node):
|
||||
with open(node.blocks_path / "xor.dat", "rb") as xor_f:
|
||||
with open(node.blocks_key_path, "rb") as xor_f:
|
||||
NUM_XOR_BYTES = 8 # From InitBlocksdirXorKey::xor_key.size()
|
||||
return xor_f.read(NUM_XOR_BYTES)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user