Skip to content

Conversation

@sipa
Copy link
Member

@sipa sipa commented Mar 21, 2012

-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

-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
@jgarzik
Copy link
Contributor

jgarzik commented Mar 22, 2012

Code appears correct. It would be nice to see -checklevel documentation somewhere besides the git log.

@sipa
Copy link
Member Author

sipa commented Mar 22, 2012

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?

@gavinandresen
Copy link
Contributor

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?

@gmaxwell
Copy link
Contributor

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)

@sipa
Copy link
Member Author

sipa commented Mar 22, 2012

Benchmark, with blk0001.dat and blkindex.dat entirely in OS cache before bitcoind startup:

-checkblocks=10000 -checklevel=?:
[1,3,10,20,20,27,45] seconds

-checkblocks=172354 -checklevel=?:
[6,22,57,122,123,153,274] seconds

@sipa
Copy link
Member Author

sipa commented Mar 22, 2012

@gmaxwell What do you mean, only yell if it fails any of the harder tests? Failing the easier tests is probably much worse.

@gavinandresen gavinandresen merged commit 4538e45 into bitcoin:master Mar 22, 2012
suprnurd pushed a commit to chaincoin-legacy/chaincoin that referenced this pull request Dec 5, 2017
6debbe6 Refactor CDarkSendEntry
- make it serializable, use constructor, pass objects of CDarkSendEntry type to functions (instead of separate variables
ptschip pushed a commit to ptschip/bitcoin that referenced this pull request Feb 28, 2018
EB or AD update -> miner string update
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants