9

Upon every start of bitcoind, I see the following in de debug log:

Verifying last 288 blocks at level 3

come up. At this point, no new blocks have been downloaded and the block chain was 100% up to date when I last closed bitcoin. Bitcoind does not do anything before it has 'verified' these 288 blocks (the server does not answer until this phase has passed).

  • Why do the last blocks need to be verified if nothing new has been added since shutdown?
  • Does this verification make any changes to any files? Does it save anything to the blocks / chainstate / database directories?

2 Answers 2

4

bitcoind -help-debug shows these options, not shown in man bitcoind or bitcoind --help:

  • -checkblocks=<n> : Check the last n blocks. Defaults to 6, and 0 indicates checking all which would take a very long time.
  • -checklevel=<n> : Perform the following verification on each block to be checked, including verifications at lower levels: (defaults to 3)
    • 0 : Reads from disk without error
    • 1 : Blocks are valid
    • 2 : Blocks have valid undo data
    • 3 : Look for disconnected tip blocks
    • 4 : Attempt reconnecting the blocks

Since this is a 5 year old question, at that time, I'm guessing it may have defaulted to more blocks, since you mentioned 288 blocks.

You can lower these values to get it to finish starting and respond faster, but you risk things going horribly wrong if something went wrong the last time it shut down, disk corruption happened, or someone maliciously altered the files.

I'm not sure what caused this, but a while ago, I ran into an error saying "Corruption: block checksum mismatch", so this verification did alert me to there being a problem, allowing me to immediately restore from backups.

2

It is to verify the block database has not been damaged or tampered with. It does not modify the databases in any way.

2
  • 1
    What does "level 3" mean? Can it be set to a different value to make the verification faster?
    – rraallvv
    Commented Nov 22, 2018 at 1:55
  • @rraallvv see other answer Commented May 10, 2020 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.