-
Notifications
You must be signed in to change notification settings - Fork 36.9k
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
Bugfix: Fix testnet-in-a-box use case #5987
Conversation
@@ -1200,7 +1200,7 @@ bool IsInitialBlockDownload() | |||
if (lockIBDState) | |||
return false; | |||
bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 || | |||
pindexBestHeader->GetBlockTime() < GetTime() - 24 * 60 * 60); | |||
pindexBestHeader->GetBlockTime() < GetTime() - Params().MaxTipAge()); |
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.
Why change this? It only determines whether the client is in initial block download, it shouldn't prevent the client from accepting blocks.
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.
IsInitialBlockDownload disables mining.
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.
Oh right, that's ugly...
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.
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.
ut ACK, though it needs rebase |
Rebased. |
@@ -179,9 +181,9 @@ class CTestNetParams : public CMainParams { | |||
|
|||
checkpointData = (Checkpoints::CCheckpointData) { | |||
boost::assign::map_list_of | |||
( 546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")), |
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.
Why remove the checkpoint? why not just add the genesis checkpoint as in jtimon@dc16119 ?
Also, why not just use consensus.hashGenesisBlock in the genesis checkpoint instead of repeating the hardcoded value?
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.
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).
Any thoughts on the nits and proposed changes to this PR? |
Along the lines of @jtimon 's comments - a genesis checkpoint does not appear to be needed. |
@jgarzik I'm actually saying the opposite: the genesis checkpoint that can be trusted (genesis block) is good, but why remove any existing checkpoint in testnet3 ? |
@jtimon That was covered in the opening PR description? "allow for older tip blocks" If we don't want that then sure, keep the checkpoint. |
The op says:
why?
I want this (like in jtimon@dc16119). jgarzik seems not to want this for some reason. |
I have no real opinion. Just moving things along. |
Checkpoints 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. |
2fa12bf
to
e65e52a
Compare
I see. They could also disable checkpoints in their test, but I don't have |
@jtimon I don't care about that proposed change, but it's certainly not a bugfix or in the scope of this PR... |
Instead of removing the checkpoint, users of testnet-in-a-box could specify the option I don't see a simple alternative solution for the tip age, though I still think having it per network is hacky. |
@laanwj If I remove the checkpoint changes here, can we merge the other part with an understanding it will go away when a better solution is found? |
@luke-jr fine with me |
@luke-jr ping |
…net-in-a-box use case)
e65e52a
to
e761d7a
Compare
Sorry for the delay, done. |
ut ACK |
utACK |
e761d7a Bugfix: Allow mining on top of old tip blocks for testnet (fixes testnet-in-a-box use case) (Luke Dashjr)
After discussion in bitcoin#7164 I think this is better. Max tip age was introduced in bitcoin#5987 to make it possible to run testnet-in-a-box. But associating this behavior with the testnet chain is wrong conceptually, as it is not needed in normal usage. Should aim to make testnet test the software as-is. Replace it with a (debug) option `-maxtipage`, which can be specified only in the specific case.
After discussion in bitcoin#7164 I think this is better. Max tip age was introduced in bitcoin#5987 to make it possible to run testnet-in-a-box. But associating this behavior with the testnet chain is wrong conceptually, as it is not needed in normal usage. Should aim to make testnet test the software as-is. Replace it with a (debug) option `-maxtipage`, which can be specified only in the specific case.
Remove testnet checkpoint and allow for older tip blocks