use -loadblock to load blk*****.dat files, but the blocks in it are not recognized
- Dominant language
- C++
- Stars
- 90.2k
- Forks
- 39.4k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 88
Description
The background is I'm trying to measure the performance of connecting real blocks when the needed inputs are not in memory. My first idea is to get some blk*****.dat files with `-stopatheight` and then use `-stopafterblockimport` and `-loadblock` to load these blk files (ConnectBlock() will run when doing this) to see the performance. But I found the blk*****.dat files can not be recognized by the code.
Though I now found an alternative way `VerifyDB()` can be leveraged to achieve my goal. I'd like still to put the above issue here.
The bitcoin core code I use is at HEAD `6ca6f3b37b Merge bitcoin/bitcoin#33241: Update libmultiprocess subtree to fix build issues`
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Current behaviour
1. I first run bitcoind -prune=1024 -stopatheight=840000 -datadir=empty_dir, then there is some block files in empty_dir/blocks.
2. Then I copy empty_dir to empty_dir2, run bitcoind -prune=1024 -stopatheight=840050 -datadir=empty_dir2
Compare two blocks dir, I now have some blk.dat files relects height 840000 to 840050.
3. At last I copy empty_dir to empty_dir3, and run bitcoind -datadir=empty_dir3 -assumevalid=0 -prune=10240 -stopafterblockimport -networkactive=0 -noconnect -listen=0 -dnsseed=0 -dns=0 -loadblock=blk04241.dat ...... -loadblock=blk04252.dat, the result shows it finds 0 blocks from those files, and I did some test, I found the reason is those files don't have the main Magic bytes f9beb4d9
Anything wrong?
### Expected behaviour
the blocks from height 840001 to 840050 are loaded from those blk files and connected to the chain.
### Steps to reproduce
see above
### Relevant log output
_No response_
### How did you obtain Bitcoin Core
Compiled from source
### What version of Bitcoin Core are you using?
master
### Operating system and version
ubuntu22.04 LTS
### Machine specifications
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.