The -checkblockindex configuration option performs occasional consistency checks of the block tree, chainstate, and other validation data structures.
There is currently no logging of the checks to see when they happen and their duration.
This patch:
- adds a
BLOCKlogging category, as the validation category is high-frequency - logs the
CChainState::CheckBlockIndex()consistency checks and duration
Example (on signet, while catching up to chain tip):
$ ./src/bitcoind -signet -checkaddrman=10 -debug=lock -debug=block
...
2021-09-12T13:03:18Z [msghand] CheckBlockIndex: consistency checks started
2021-09-12T13:03:18Z [opencon] Enter: lock contention cs_main, net_processing.cpp:1152 started
2021-09-12T13:03:18Z [msghand] CheckBlockIndex: consistency checks completed (433.58ms)
2021-09-12T13:03:18Z [msghand] CheckBlockIndex: consistency checks started
2021-09-12T13:03:19Z [msghand] CheckBlockIndex: consistency checks completed (411.67ms)
2021-09-12T13:03:19Z [opencon] Enter: lock contention cs_main, net_processing.cpp:1152 completed (811929μs)
To test:
$ ./src/bitcoind -debug=block