Skip to content

Commit 64b80d5

Browse files
fjahrL0laL33tz
authored andcommitted
test: simplify feature_init
1 parent d2b8c5e commit 64b80d5

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

test/functional/feature_init.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,12 @@ def check_clean_start():
133133

134134
for target_file in target_files:
135135
self.log.info(f"Perturbing file to ensure failure {target_file}")
136-
with open(target_file, "rb") as tf_read:
137-
contents = tf_read.read()
138-
tweaked_contents = bytearray(contents)
136+
with open(target_file, "r+b") as tf:
139137
# Since the genesis block is not checked by -checkblocks, the
140138
# perturbation window must be chosen such that a higher block
141139
# in blk*.dat is affected.
142-
tweaked_contents[150:350] = b'1' * 200
143-
with open(target_file, "wb") as tf_write:
144-
tf_write.write(bytes(tweaked_contents))
140+
tf.seek(150)
141+
tf.write(b'1' * 200)
145142

146143
start_expecting_error(err_fragment)
147144

0 commit comments

Comments
 (0)