This PR was suggested in this comment in #19594, and builds on that PR (the first commit here).
This PR allows the blocks in files specified by the -loadblock=file
command line (configuration) options (there can be multiple) to be unsorted. This is already allowed by -reindex
, but currently when -loadblock
encounters a block with an unknown parent, it is ignored. This means the blocks must be sorted by height to be loaded successfully. This PR fixes this restriction, allowing the blocks across all the specified blocks files to be in any order. This makes the -loadblock
option more useful. Also, the affected code is cleaner and more maintainable.
(I’ll simplify this description move details to a separate comment before this PR gets merged.)