IBD check uses minimumchain work instead of checkpoints.
This introduces a 'minimum chain work' chainparam which is intended to be the known amount of work in the chain for the network at the time of software release. If you don't have this much work, you're not yet caught up. This is used instead of the count of blocks test from checkpoints. This criteria is trivial to keep updated as there is no element of subjectivity, trust, or position dependence to it. It is also a more reliable metric of sync status than a block count.
This commit is contained in:
parent
02eedeeb69
commit
e41632c9fb
|
@ -24,6 +24,8 @@ Check that there are no surprising performance regressions:
|
||||||
|
|
||||||
Ensure that new performance metrics appear on that site.
|
Ensure that new performance metrics appear on that site.
|
||||||
|
|
||||||
|
Update `src/chainparams.cpp` nMinimumChainWork with information from the getblockchaininfo rpc.
|
||||||
|
|
||||||
### Protocol Safety Checks:
|
### Protocol Safety Checks:
|
||||||
|
|
||||||
If this release changes the behavior of the protocol or fixes a serious
|
If this release changes the behavior of the protocol or fixes a serious
|
||||||
|
|
|
@ -106,6 +106,9 @@ public:
|
||||||
consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight =
|
consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight =
|
||||||
Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT;
|
Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT;
|
||||||
|
|
||||||
|
// The best chain should have at least this much work.
|
||||||
|
consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000000000281b32ff3198a1");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The message start string should be awesome! ⓩ❤
|
* The message start string should be awesome! ⓩ❤
|
||||||
*/
|
*/
|
||||||
|
@ -268,6 +271,9 @@ public:
|
||||||
consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight =
|
consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight =
|
||||||
Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT;
|
Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT;
|
||||||
|
|
||||||
|
// The best chain should have at least this much work.
|
||||||
|
consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000000000000001d0c4d9cd");
|
||||||
|
|
||||||
pchMessageStart[0] = 0xfa;
|
pchMessageStart[0] = 0xfa;
|
||||||
pchMessageStart[1] = 0x1a;
|
pchMessageStart[1] = 0x1a;
|
||||||
pchMessageStart[2] = 0xf9;
|
pchMessageStart[2] = 0xf9;
|
||||||
|
@ -317,6 +323,7 @@ public:
|
||||||
fMineBlocksOnDemand = false;
|
fMineBlocksOnDemand = false;
|
||||||
fTestnetToBeDeprecatedFieldRPC = true;
|
fTestnetToBeDeprecatedFieldRPC = true;
|
||||||
|
|
||||||
|
|
||||||
checkpointData = (CCheckpointData) {
|
checkpointData = (CCheckpointData) {
|
||||||
boost::assign::map_list_of
|
boost::assign::map_list_of
|
||||||
(0, consensus.hashGenesisBlock)
|
(0, consensus.hashGenesisBlock)
|
||||||
|
@ -380,6 +387,9 @@ public:
|
||||||
consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight =
|
consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight =
|
||||||
Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT;
|
Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT;
|
||||||
|
|
||||||
|
// The best chain should have at least this much work.
|
||||||
|
consensus.nMinimumChainWork = uint256S("0x00");
|
||||||
|
|
||||||
pchMessageStart[0] = 0xaa;
|
pchMessageStart[0] = 0xaa;
|
||||||
pchMessageStart[1] = 0xe8;
|
pchMessageStart[1] = 0xe8;
|
||||||
pchMessageStart[2] = 0x3f;
|
pchMessageStart[2] = 0x3f;
|
||||||
|
|
|
@ -98,6 +98,7 @@ struct Params {
|
||||||
int64_t AveragingWindowTimespan() const { return nPowAveragingWindow * nPowTargetSpacing; }
|
int64_t AveragingWindowTimespan() const { return nPowAveragingWindow * nPowTargetSpacing; }
|
||||||
int64_t MinActualTimespan() const { return (AveragingWindowTimespan() * (100 - nPowMaxAdjustUp )) / 100; }
|
int64_t MinActualTimespan() const { return (AveragingWindowTimespan() * (100 - nPowMaxAdjustUp )) / 100; }
|
||||||
int64_t MaxActualTimespan() const { return (AveragingWindowTimespan() * (100 + nPowMaxAdjustDown)) / 100; }
|
int64_t MaxActualTimespan() const { return (AveragingWindowTimespan() * (100 + nPowMaxAdjustDown)) / 100; }
|
||||||
|
uint256 nMinimumChainWork;
|
||||||
};
|
};
|
||||||
} // namespace Consensus
|
} // namespace Consensus
|
||||||
|
|
||||||
|
|
|
@ -1740,7 +1740,9 @@ bool IsInitialBlockDownload()
|
||||||
return false;
|
return false;
|
||||||
if (fImporting || fReindex)
|
if (fImporting || fReindex)
|
||||||
return true;
|
return true;
|
||||||
if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()))
|
if (chainActive.Tip() == NULL)
|
||||||
|
return true;
|
||||||
|
if (chainActive.Tip()->nChainWork < UintToArith256(chainParams.GetConsensus().nMinimumChainWork))
|
||||||
return true;
|
return true;
|
||||||
bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 ||
|
bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 ||
|
||||||
pindexBestHeader->GetBlockTime() < GetTime() - nMaxTipAge);
|
pindexBestHeader->GetBlockTime() < GetTime() - nMaxTipAge);
|
||||||
|
@ -1758,7 +1760,7 @@ void CheckForkWarningConditions()
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
// Before we get past initial download, we cannot reliably alert about forks
|
// Before we get past initial download, we cannot reliably alert about forks
|
||||||
// (we assume we don't get stuck on a fork before the last checkpoint)
|
// (we assume we don't get stuck on a fork before finishing our initial sync)
|
||||||
if (IsInitialBlockDownload())
|
if (IsInitialBlockDownload())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue