Remove testnet checkpoint and allow for older tip blocks
Bugfix: Fix testnet-in-a-box use case #5987
pull luke-jr wants to merge 1 commits into bitcoin:master from luke-jr:bugfix_tniab changing 3 files +6 −1-
luke-jr commented at 11:56 AM on April 9, 2015: member
-
in src/main.cpp:None in f976f982d6 outdated
1199 | @@ -1200,7 +1200,7 @@ bool IsInitialBlockDownload() 1200 | if (lockIBDState) 1201 | return false; 1202 | bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 || 1203 | - pindexBestHeader->GetBlockTime() < GetTime() - 24 * 60 * 60); 1204 | + pindexBestHeader->GetBlockTime() < GetTime() - Params().MaxTipAge());
laanwj commented at 11:54 AM on April 10, 2015:Why change this? It only determines whether the client is in initial block download, it shouldn't prevent the client from accepting blocks.
luke-jr commented at 11:58 AM on April 10, 2015:IsInitialBlockDownload disables mining.
laanwj commented at 11:31 AM on April 15, 2015:Oh right, that's ugly...
jtimon commented at 12:39 PM on April 25, 2015:would you mind to declare
const CChainParams& chainparams = Params();at the beginning of the function and use chainparams.MaxTipAge() instead? That will make passing CChainParams as an argument to IsInitialBlockDownload() simpler later.laanwj added the label Mining on Apr 24, 2015luke-jr force-pushed on Apr 25, 2015laanwj cross-referenced this on Apr 29, 2015 from issue Avoid crash on start in TestBlockValidity with gen=1. by gmaxwelllaanwj cross-referenced this on May 18, 2015 from issue Private testnet mining is broken in version 0.10.0 by apolovallaanwj cross-referenced this on May 21, 2015 from issue Ignore getheaders requests when not synced by sdaftuarunknown cross-referenced this on Jun 2, 2015 from issue CPU Mining on Testnet (sic!) by ghostjtimon commented at 1:11 PM on June 21, 2015: contributorut ACK, though it needs rebase
luke-jr closed this on Jun 23, 2015luke-jr force-pushed on Jun 23, 2015luke-jr reopened this on Jun 23, 2015luke-jr commented at 8:38 AM on June 23, 2015: memberRebased.
in src/chainparams.cpp:None in 2fa12bf8b2 outdated
180 | @@ -179,9 +181,9 @@ class CTestNetParams : public CMainParams { 181 | 182 | checkpointData = (Checkpoints::CCheckpointData) { 183 | boost::assign::map_list_of 184 | - ( 546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")),
jtimon commented at 9:54 AM on June 26, 2015:Why remove the checkpoint? why not just add the genesis checkpoint as in https://github.com/jtimon/bitcoin/commit/dc1611925dd36f07d1cf3412237610b864a99bcc ? Also, why not just use consensus.hashGenesisBlock in the genesis checkpoint instead of repeating the hardcoded value?
jtimon commented at 10:02 AM on June 26, 2015:In fact, why not add the genesis checkpoint (the genesis block, the only checkpoint that cannot be reorged) to the mainchain too (and while at it use consensus.hashGenesisBlock for regtest's gensis checkpoint for uniformity).
jtimon cross-referenced this on Jun 26, 2015 from issue Checkpoints: The hash of the genesis block it's the genesis checkpoint by jtimonjtimon commented at 12:39 PM on June 29, 2015: contributorAny thoughts on the nits and proposed changes to this PR?
jtimon commented at 8:35 PM on September 15, 2015: contributorThe op says:
Remove testnet checkpoint
why?
...and allow for older tip blocks
I want this (like in https://github.com/jtimon/bitcoin/commit/dc1611925dd36f07d1cf3412237610b864a99bcc). jgarzik seems not to want this for some reason.
jgarzik commented at 8:46 PM on September 15, 2015: contributorI have no real opinion. Just moving things along.
luke-jr commented at 12:32 AM on September 20, 2015: memberCheckpoints beyond the genesis block are a problem because testnet-in-a-box networks won't have those blocks.
MaxTipAge is needed because otherwise mining the first (non-genesis) block is impossible on such a network.
luke-jr force-pushed on Sep 20, 2015jtimon commented at 8:31 AM on September 21, 2015: contributorCheckpoints beyond the genesis block are a problem because testnet-in-a-box networks won't have those blocks.
I see. They could also disable checkpoints in their test, but I don't have a strong opinion: I'm fine removing it if that's the motivation. What about the rest of my feedback (ie making sure all ghains have a genesis checkpoint and using hardcoded values as little as possible)?
laanwj commented at 4:17 PM on September 22, 2015: memberInstead of removing the checkpoint, users of testnet-in-a-box could specify the option
-checkpoints=0- right?I don't see a simple alternative solution for the tip age, though I still think having it per network is hacky.
jtimon commented at 5:29 PM on September 22, 2015: contributorBugfix: Allow mining on top of old tip blocks for testnet (fixes testnet-in-a-box use case) e761d7a94fluke-jr force-pushed on Sep 29, 2015luke-jr commented at 7:47 PM on September 29, 2015: memberSorry for the delay, done.
jgarzik commented at 10:22 AM on October 1, 2015: contributorut ACK
laanwj commented at 12:06 PM on October 1, 2015: memberutACK
laanwj merged this on Oct 1, 2015laanwj closed this on Oct 1, 2015laanwj referenced this in commit 4899a04c24 on Oct 1, 2015laanwj cross-referenced this on Dec 4, 2015 from issue Do not download transactions during initial blockchain sync by ptschiplaanwj referenced this in commit 64360f1304 on Dec 14, 2015laanwj cross-referenced this on Dec 14, 2015 from issue Make max tip age an option instead of chainparam by laanwjdeadalnix referenced this in commit d9ec1a7db1 on Jan 11, 2017deadalnix referenced this in commit 27d238fdb1 on Jan 11, 2017deadalnix referenced this in commit a193ba35df on Jan 15, 2017deadalnix referenced this in commit 890e1c1dda on Jan 16, 2017deadalnix referenced this in commit 398d02958b on Jan 17, 2017deadalnix referenced this in commit 3015c86761 on Jan 19, 2017deadalnix referenced this in commit e442224c4b on Jan 19, 2017deadalnix referenced this in commit 36cf0f2266 on Jan 19, 2017deadalnix referenced this in commit 1164b55292 on Jan 26, 2017deadalnix referenced this in commit 85a832d6a6 on Feb 12, 2017sickpig referenced this in commit 52db63687f on Feb 25, 2017deadalnix referenced this in commit c2a143452c on Feb 27, 2017deadalnix referenced this in commit fa68b4bcd3 on Feb 27, 2017deadalnix cross-referenced this on Feb 27, 2017 from issue Make max tip age an option instead of chainparam by deadalnixbitcoin locked this on Sep 8, 2021LabelsLinked (view graph)#5742 CPU Mining on Testnet (sic!)#5984 Private testnet mining is broken in version 0.10.0#6079 Avoid crash on start in TestBlockValidity with gen=1.#6172 Ignore getheaders requests when not synced#6230 Checkpoints: The hash of the genesis block it's the genesis checkpoint#6382 DEPENDENT: Chainparams: Introduce N testnet chains to test different block sizes#7164 Do not download transactions during initial blockchain sync#7208 Make max tip age an option instead of chainparam
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