-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Really don't validate genesis block #9102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
EDIT: walletbackup.py doesn't really pass locally, only when I run it individually, the failure seems to start at 50e8a9c EDIT2: I would test ACK master...jtimon:0.13-instagibbs-dontvalidategenesis though (based on e984730 works for me) |
@@ -199,7 +199,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts(boost::function<CBlockIndex*(const uint256 | |||
pindexNew->nStatus = diskindex.nStatus; | |||
pindexNew->nTx = diskindex.nTx; | |||
|
|||
if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus())) | |||
if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus()) && pindexNew->GetBlockHash() != Params().GetConsensus().hashGenesisBlock) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style nit: perhaps new line after && here?
I wonder how many times we've purportedly fixed this. Can you please add a test to make sure that the genesis block is really, really not validated and to prevent this from regressing again? |
@laanwj Until we have a method of loading up our own test networks via json/whatever I'm not sure how to test this. We need to create an invalid genesis block and has it pass, right? |
@laanwj You may be remembering some of my previous attempts at doing this (like #6597 or #6230 ), but they didn't get merged. It is true that the only way to make sure it is and remains complete is to test it though. |
Needs rebase. |
6e18ae4
to
10be0c5
Compare
rebased |
As a reminder, #8994 tests this commit with all python tests except for p2p-segwit.py and p2p-compactblocks.py. |
Closing as it needs tests, and #8994 provides those, so they should be packaged together. |
…gen block d97920c add functional test for coinbase connection to db (Gregory Sanders) e532664 allow grabbing genesis transaction(s) when connected (Gregory Sanders) c7e5549 [bitcoin#9102] really don't validate genesis block (Gregory Sanders) ccf40db connect genesis block transaction outputs to coin db (Gregory Sanders) Pull request description: Tests should now be working. Tree-SHA512: aa2af6637c534d7f9185e969118b52519fe0609ae79fa8f4d5213f939f9a5915f958cf93d02aa6f4a47795c87cc23c93daff3807347cb1b12a426326e6dea60e
A few more places where genesis blocks are being tested for validity and would pop up when tested chainparam configurations. Genesis block should be treated as a consensus rule.