I noticed that during initial block download (IBD) the blocks can arrive out of order and will hence be stored out of order. I’m maintaining a few nodes and, although it is busy work, I’d like to store the blocks in the blk_____.dat files sequentially. My main goal of this is to allow me to have a reproducible SHA checksum for the blk_____.dat files. I do my IBD on fast machines and run the live nodes on slow machines. Doing this process on the “slow” machines would take forever, hence the need for checking files at rest with an off the shelf checksum utility.
My best guess to get this done would be:
1. Perform an IBD on some node.
2. Use the [linearize script](https://github.com/bitcoin/bitcoin/tree/v0.21.1/contrib/linearize) to create a `bootstrap.dat` file.
3. On a “fresh” install of 0.21.1, import bootstrap.dat using the `-loadblock` switch
4. Checksum all the `blk_____.dat` files I wish
Once done, any node created using step #3 should have matching checksums for “old” `blk_____.dat` files. Obviously `blk_____.dat` files created after the `loadblock` event have the potential to have out of order blocks again.
Is this correct?
View Reddit by brianddk – View Source