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 force-pushed on Jun 26, 2015
  9. 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.
  10. jtimon force-pushed on Jun 26, 2015
  11. jtimon force-pushed on Jun 26, 2015
  12. jtimon force-pushed on Jun 30, 2015
  13. jtimon force-pushed on Jul 1, 2015
  14. jtimon force-pushed on Jul 1, 2015
  15. 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 ?
  16. 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.
  17. jtimon force-pushed on Jul 1, 2015
  18. 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!

  19. 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
  20. Checkpoints: The hash of the genesis block it's the genesis checkpoint 0c576b2eaa
  21. jtimon force-pushed on Jul 2, 2015
  22. 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.
  23. jtimon closed this on Jul 6, 2015

  24. DrahtBot 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: 2024-12-18 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me