File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 55"""Stress tests related to node initialization."""
66import os
77from pathlib import Path
8+ from random import randint
89import shutil
910
1011from test_framework .test_framework import BitcoinTestFramework , SkipTest
@@ -131,15 +132,12 @@ def check_clean_start():
131132
132133 for target_file in target_files :
133134 self .log .info (f"Perturbing file to ensure failure { target_file } " )
134- with open (target_file , "rb" ) as tf_read :
135- contents = tf_read .read ()
136- tweaked_contents = bytearray (contents )
135+ with open (target_file , "r+b" ) as tf :
137136 # Since the genesis block is not checked by -checkblocks, the
138137 # perturbation window must be chosen such that a higher block
139138 # in blk*.dat is affected.
140- tweaked_contents [150 :350 ] = b'1' * 200
141- with open (target_file , "wb" ) as tf_write :
142- tf_write .write (bytes (tweaked_contents ))
139+ tf .seek (randint (150 , 15000 ))
140+ tf .write (b'1' * randint (20 , 2000 ))
143141
144142 start_expecting_error (err_fragment )
145143
You can’t perform that action at this time.
0 commit comments