mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-04 02:18:36 +02:00
test: simplify feature_init
This commit is contained in:
@@ -133,15 +133,12 @@ class InitStressTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
for target_file in target_files:
|
for target_file in target_files:
|
||||||
self.log.info(f"Perturbing file to ensure failure {target_file}")
|
self.log.info(f"Perturbing file to ensure failure {target_file}")
|
||||||
with open(target_file, "rb") as tf_read:
|
with open(target_file, "r+b") as tf:
|
||||||
contents = tf_read.read()
|
|
||||||
tweaked_contents = bytearray(contents)
|
|
||||||
# Since the genesis block is not checked by -checkblocks, the
|
# Since the genesis block is not checked by -checkblocks, the
|
||||||
# perturbation window must be chosen such that a higher block
|
# perturbation window must be chosen such that a higher block
|
||||||
# in blk*.dat is affected.
|
# in blk*.dat is affected.
|
||||||
tweaked_contents[150:350] = b'1' * 200
|
tf.seek(150)
|
||||||
with open(target_file, "wb") as tf_write:
|
tf.write(b'1' * 200)
|
||||||
tf_write.write(bytes(tweaked_contents))
|
|
||||||
|
|
||||||
start_expecting_error(err_fragment)
|
start_expecting_error(err_fragment)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user