aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_init.py
diff options
context:
space:
mode:
authorFabian Jahr <fjahr@protonmail.com>2023-09-28 13:58:18 +0200
committerL0la L33tz <L0l4L33tz@proton.me>2023-10-08 17:25:27 +0200
commit64b80d5c5bc1311cd2fb188f2d84aff6704e27d7 (patch)
treeb7b0b0fa18ea6e46a0cddcf1b7e3aa16c35e4580 /test/functional/feature_init.py
parentd2b8c5e1234cdaff84bd1f60aea598d219cdac5e (diff)
downloadbitcoin-64b80d5c5bc1311cd2fb188f2d84aff6704e27d7.tar.xz
test: simplify feature_init
Diffstat (limited to 'test/functional/feature_init.py')
-rwxr-xr-xtest/functional/feature_init.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/test/functional/feature_init.py b/test/functional/feature_init.py
index 94f5116f9b..1b657e2c47 100755
--- a/test/functional/feature_init.py
+++ b/test/functional/feature_init.py
@@ -133,15 +133,12 @@ class InitStressTest(BitcoinTestFramework):
for target_file in target_files:
self.log.info(f"Perturbing file to ensure failure {target_file}")
- with open(target_file, "rb") as tf_read:
- contents = tf_read.read()
- tweaked_contents = bytearray(contents)
+ with open(target_file, "r+b") as tf:
# Since the genesis block is not checked by -checkblocks, the
# perturbation window must be chosen such that a higher block
# in blk*.dat is affected.
- tweaked_contents[150:350] = b'1' * 200
- with open(target_file, "wb") as tf_write:
- tf_write.write(bytes(tweaked_contents))
+ tf.seek(150)
+ tf.write(b'1' * 200)
start_expecting_error(err_fragment)