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.
Really don't validate genesis block #9102
pull instagibbs wants to merge 1 commits into bitcoin:master from instagibbs:dontvalidategenesis changing 2 files +10 −8-
instagibbs commented at 2:05 AM on November 8, 2016: member
-
instagibbs commented at 2:15 AM on November 8, 2016: member
Moving the CheckBlock in ConnectBlock seems to cause p2p-compactblocks.py to stall out when run in batch. Perhaps seeing patterns that do not exist. -
in src/txdb.cpp:None in 6e18ae4183 outdated
198 | @@ -199,7 +199,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts(boost::function<CBlockIndex*(const uint256 199 | pindexNew->nStatus = diskindex.nStatus; 200 | pindexNew->nTx = diskindex.nTx; 201 | 202 | - if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus())) 203 | + if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus()) && pindexNew->GetBlockHash() != Params().GetConsensus().hashGenesisBlock)
jtimon commented at 3:30 AM on November 8, 2016:style nit: perhaps new line after && here?
jtimon commented at 3:39 AM on November 8, 2016: contributortested ACK 6e18ae4EDIT: walletbackup.py doesn't really pass locally, only when I run it individually, the failure seems to start at 50e8a9cc
EDIT2: I would test ACK https://github.com/bitcoin/bitcoin/compare/master...jtimon:0.13-instagibbs-dontvalidategenesis though (based on e9847303 works for me)
jtimon approvedjtimon cross-referenced this on Nov 8, 2016 from issue Testchains: Introduce custom chain whose constructor... by jtimonlaanwj commented at 10:11 AM on November 8, 2016: memberI 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?
dcousens approvedinstagibbs commented at 1:40 PM on November 8, 2016: member@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?
jtimon commented at 1:58 PM on November 8, 2016: contributor@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. But I'm afraid the only way to test this is from rpc and with a new chain whose genesis block is actually invalid (and not only in pow but other things like bip34). We could more easily write such a test with something like #8994 which contains this and other things to make testchains more easily.
fanquake added the label Validation on Nov 9, 2016jtimon cross-referenced this on Nov 22, 2016 from issue NOMERGE: WIP: Support block signed custom testchains by jtimonpaveljanik commented at 9:37 PM on February 22, 2017: contributorNeeds rebase.
Really don't validate genesis block 10be0c5b46instagibbs force-pushed on Feb 24, 2017instagibbs commented at 3:27 PM on February 24, 2017: memberrebased
jtimon commented at 7:00 PM on February 24, 2017: contributorAs a reminder, #8994 tests this commit with all python tests except for p2p-segwit.py and p2p-compactblocks.py. @laanwj would that be sufficient testing? Is there a simpler way to test it and have tests that prevent this from breaking again than create a new regtest-like testchain whose genesis block doesn't satisfy pow?
jtimon cross-referenced this on Mar 24, 2017 from issue 8994: Testchains: Introduce custom chain whose constructor... by jtimoninstagibbs commented at 6:51 PM on May 18, 2017: memberClosing as it needs tests, and #8994 provides those, so they should be packaged together.
instagibbs closed this on May 18, 2017MarcoFalke cross-referenced this on Aug 16, 2019 from issue consensus: skip genesis block POW check by kallewoofjtimon cross-referenced this on Sep 10, 2019 from issue BIP-325: Signet support by kallewoofkallewoof referenced this in commit c7e5549317 on Oct 4, 2019kallewoof referenced this in commit c0d1dbc833 on Oct 4, 2019jtimon cross-referenced this on Jan 9, 2020 from issue Testschains: Many regtests with different genesis and default datadir by jtimonbitcoin locked this on Sep 8, 2021ContributorsLabelsLinked (view graph)#6230 Checkpoints: The hash of the genesis block it's the genesis checkpoint#6597 Chainparams: Don't check the genesis block#8994 Testchains: Introduce custom chain whose constructor... #9177 NOMERGE: WIP: Support block signed custom testchains#16411 BIP-325: Signet support#16630 consensus: skip genesis block POW check#17037 Testschains: Many regtests with different genesis and default datadir
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:55 UTC