Fixes #28603
Added suggested simplifications and implemented randomization
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For detailed information about the code coverage, see the test coverage report.
See the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
137@@ -137,8 +138,8 @@ def check_clean_start():
138 # Since the genesis block is not checked by -checkblocks, the
139 # perturbation window must be chosen such that a higher block
140 # in blk*.dat is affected.
141- tf.seek(150)
142- tf.write(b'1' * 200)
143+ tf.seek(randint (150, 15000))
For more clarification @brunoerg the 150 starting point was chosen in the previous test to exclude the genesis block iiuc. The 15000 range should be large enough to provide efficient randomization but small enough to not end outside of the blockfile (200 blocks in the test with ~160 characters each). Could also shorten or enlarge the range ((200*160 = 32000 characters) but I thought 15000 would a good middle ground.
Let me know if you have any suggestions. Can also add a line of documentation if necessary.
Light ACK 5ab6419f380cc0a8cde78b125f3eeee5fcba43ae
The refactoring changes in the first commit look correct and randomizing offset/size of the perturbation data seems to be an improvement for discovering more issues. Can’t say much about the concrete random ranges chosen though, it might make sense to have someone review this that has more insight into the file format or specific cases that were in mind to be triggered (on the other hand, perfect is the enemy of good…).