Add -checklevel and improve -checkblocks#972
Conversation
-checkblocks now takes a numeric argument: the number of blocks that must be verified at the end of the chain. Default is 2500, and 0 means all blocks. -checklevel specifies how thorough the verification must be: 0: only check whether the block exists on disk 1: verify block validity (default) 2: verify transaction index validity 3: check transaction hashes 4: check whether spent txouts were spent within the main chain 5: check whether all prevouts are marked spent 6: check whether spent txouts were spent by a valid transaction that consumes them
|
Code appears correct. It would be nice to see -checklevel documentation somewhere besides the git log. |
|
I've done a level-6 check on a full blockchain without any found errors (takes around 10 minutes in combination with fastblocks). Note that even level 6 does not do signature/script checking. Also: agree, check levels should be documented. But where? |
|
Where to document: How about a doc/troubleshooting file that describes how to use -checkblocks and -rescan and -dumpblock and any other undocumented goodies hiding in the source code? |
|
I'd really like to see the level turned up on the initial check, but I don't think we can do this until we're more confident that the check is incorrect. Perhaps make it run with the higher level on the initial check— but only yell in the logs if it fails any of the harder tests? Can you think of a way of detecting that the database was copied from another node? Doing a complete check at the highest level would go a long way to making blockchain downloads safer. (My concern being data errors creeping into a popular download site causing a massive fork) |
|
Benchmark, with blk0001.dat and blkindex.dat entirely in OS cache before bitcoind startup: -checkblocks=10000 -checklevel=?: -checkblocks=172354 -checklevel=?: |
|
@gmaxwell What do you mean, only yell if it fails any of the harder tests? Failing the easier tests is probably much worse. |
6debbe6 Refactor CDarkSendEntry - make it serializable, use constructor, pass objects of CDarkSendEntry type to functions (instead of separate variables
EB or AD update -> miner string update
-checkblocks now takes a numeric argument: the number of blocks that must be verified at the end of the chain. Default is 2500, and 0 means all blocks.
-checklevel specifies how thorough the verification must be:
0: only check whether the block exists on disk
1: verify block validity (default)
2: verify transaction index validity
3: check transaction hashes
4: check whether spent txouts were spent within the main chain
5: check whether all prevouts are marked spent
6: check whether spent txouts were spent by a valid transaction that consume them