Checkpoints: The hash of the genesis block it's the genesis checkpoint #6230

pull jtimon wants to merge 1 commits into bitcoin:master from jtimon:chainparams-genesis changing 1 files +3 −1
  1. jtimon commented at 10:37 AM on June 4, 2015: contributor

    It's nicer to have all the hardcoded hashes of the genesis blocks of the respective supported chains together. More importantly, all chains should have the genesis block as checkpoint. That way the checkpoint logic can always trust the first checkpoint and hopefully we will be able to save some if (block.GetHash() != chainparams.GetConsensus().hashGenesisBlock) here and there. I also add some tests to checkpoints. They're not very important since the asserts in chainparams would already detect any change in the genesis block, but it makes sure that "the checkpoint logic can always trust the first checkpoint". In fact, the genesis checkpoint is that is immune to reorgs, by definition. The genesis block is the first rule and the only true chain ID (because one based in names would require a memorable-ID system [and those are centralized and/or vulnerable to squatting]). (Shares base commit with #6229)

  2. jtimon force-pushed on Jun 4, 2015
  3. jtimon renamed this:
    Chainparams: The hash of the genesis block it's the genesis checkpoint and chain id
    Chainparams: The hash of the genesis block is the genesis checkpoint and chain id
    on Jun 4, 2015
  4. laanwj added the label Refactoring on Jun 9, 2015
  5. jtimon force-pushed on Jun 21, 2015
  6. jtimon force-pushed on Jun 21, 2015
  7. jtimon commented at 10:24 AM on June 26, 2015: contributor

    Added an alternative solution to the bug described in #6299. It may also solve #5984 (at least it shares some code with #5987) and maybe also other bugs related to not having a genesis checkpoint (the genesis block) in all chain modes.

  8. jtimon cross-referenced this on Jun 26, 2015 from issue Bugfix: Don't check the genesis block header before accepting it by jtimon
  9. jtimon force-pushed on Jun 26, 2015
  10. jtimon commented at 3:56 PM on June 26, 2015: contributor

    Rebased after merging #6299. Apart from its original form, now this PR additionally has the a removal of the now-unnecessary check for the genesis hash block (and an additional big indentation commit). Let's wait for testing, I think it was safer to just merge #6299, but I truly believe the existence of a fully-trustable genesis checkpoint is the necessary step for decoupling the checkpoint logic from any notion of chainparams or a genesis block hash. I think I'm finding enough prove that problems can spring by not doing so and - still - this PR would be minimal if the enum-to-string was merged somewhere else (like in the currently closed #6229 or an improved subset of it) and ignoring the trivially-verifiable indentation.

  11. jtimon force-pushed on Jun 26, 2015
  12. jtimon force-pushed on Jun 26, 2015
  13. jtimon force-pushed on Jun 30, 2015
  14. jtimon cross-referenced this on Jul 1, 2015 from issue Chainparams: Separate globals and depedendent functions by jtimon
  15. jtimon force-pushed on Jul 1, 2015
  16. jtimon force-pushed on Jul 1, 2015
  17. jtimon commented at 5:26 PM on July 1, 2015: contributor

    Updated without adding any tests or sharing a commit with #6229. @sdaftuar Can you confirm that this also solves the problem you found, which was solved in #6299 ?

  18. sdaftuar commented at 7:46 PM on July 1, 2015: member

    @jtimon Just looked at this, reindex.py fails, I think essentially for the same reason it failed before #6299 was merged.

  19. jtimon force-pushed on Jul 1, 2015
  20. jtimon commented at 9:35 PM on July 1, 2015: contributor

    Yes, @sdaftuar , you're right, this is no alternative fix of #6299 . I was testing it wrong, but fortunately qa/rpc-tests/reindex.py noticed, great! I removed everything but the single commit introducing the "genesis checkpoints", which @TheBlueMatt should like because he did the equivalent for alpha-0.10. If @luke-jr rebases #5987 on top of this I can close the PR.

    In summary and to reiterate, there's no reason not to have the genesis block as a checkpoint: it's the best checkpoint you will ever have! by definition!

  21. jtimon renamed this:
    Chainparams: The hash of the genesis block is the genesis checkpoint and chain id
    Checkpoints: The hash of the genesis block it's the genesis checkpoint
    on Jul 1, 2015
  22. Checkpoints: The hash of the genesis block it's the genesis checkpoint 0c576b2eaa
  23. jtimon force-pushed on Jul 2, 2015
  24. jtimon commented at 8:24 AM on July 6, 2015: contributor

    Closing for now. I will reopen again with the version with the tests. In the meantime @luke-jr can take this for his PR if he wants to.

  25. jtimon closed this on Jul 6, 2015

  26. jtimon cross-referenced this on Aug 29, 2015 from issue DEPENDENT: Chainparams: Introduce N testnet chains to test different block sizes by jtimon
  27. jtimon cross-referenced this on Nov 8, 2016 from issue Really don't validate genesis block by instagibbs
  28. bitcoin locked this on Sep 8, 2021

github-metadata-mirror

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