Adjust best fork warning conditions
Signed-off-by: Anthony Fieroni <bvbfan@abv.bg>
This commit is contained in:
parent
ed26eb347f
commit
d3f9a44e57
1 changed files with 4 additions and 4 deletions
|
@ -1443,9 +1443,9 @@ static void CheckForkWarningConditions() EXCLUSIVE_LOCKS_REQUIRED(cs_main)
|
||||||
if (::ChainstateActive().IsInitialBlockDownload())
|
if (::ChainstateActive().IsInitialBlockDownload())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If our best fork is no longer within 72 blocks (+/- 12 hours if no one mines it)
|
// If our best fork is no longer within 288 blocks (~ 24 blocks per hour +/- 12 hours if no one mines it)
|
||||||
// of our head, drop it
|
// of our head, drop it
|
||||||
if (pindexBestForkTip && ::ChainActive().Height() - pindexBestForkTip->nHeight >= 72)
|
if (pindexBestForkTip && ::ChainActive().Height() - pindexBestForkTip->nHeight >= 288)
|
||||||
pindexBestForkTip = nullptr;
|
pindexBestForkTip = nullptr;
|
||||||
|
|
||||||
if (pindexBestForkTip || (pindexBestInvalid && pindexBestInvalid->nChainWork > ::ChainActive().Tip()->nChainWork + (GetBlockProof(*::ChainActive().Tip()) * 6)))
|
if (pindexBestForkTip || (pindexBestInvalid && pindexBestInvalid->nChainWork > ::ChainActive().Tip()->nChainWork + (GetBlockProof(*::ChainActive().Tip()) * 6)))
|
||||||
|
@ -1492,7 +1492,7 @@ static void CheckForkWarningConditionsOnNewFork(CBlockIndex* pindexNewForkTip) E
|
||||||
}
|
}
|
||||||
|
|
||||||
// We define a condition where we should warn the user about as a fork of at least 7 blocks
|
// We define a condition where we should warn the user about as a fork of at least 7 blocks
|
||||||
// with a tip within 72 blocks (+/- 12 hours if no one mines it) of ours
|
// with a tip within 288 blocks (+/- 12 hours if no one mines it) of ours
|
||||||
// We use 7 blocks rather arbitrarily as it represents just under 10% of sustained network
|
// We use 7 blocks rather arbitrarily as it represents just under 10% of sustained network
|
||||||
// hash rate operating on the fork.
|
// hash rate operating on the fork.
|
||||||
// or a chain that is entirely longer than ours and invalid (note that this should be detected by both)
|
// or a chain that is entirely longer than ours and invalid (note that this should be detected by both)
|
||||||
|
@ -1500,7 +1500,7 @@ static void CheckForkWarningConditionsOnNewFork(CBlockIndex* pindexNewForkTip) E
|
||||||
// the 7-block condition and from this always have the most-likely-to-cause-warning fork
|
// the 7-block condition and from this always have the most-likely-to-cause-warning fork
|
||||||
if (pfork && (!pindexBestForkTip || pindexNewForkTip->nHeight > pindexBestForkTip->nHeight) &&
|
if (pfork && (!pindexBestForkTip || pindexNewForkTip->nHeight > pindexBestForkTip->nHeight) &&
|
||||||
pindexNewForkTip->nChainWork - pfork->nChainWork > (GetBlockProof(*pfork) * 7) &&
|
pindexNewForkTip->nChainWork - pfork->nChainWork > (GetBlockProof(*pfork) * 7) &&
|
||||||
::ChainActive().Height() - pindexNewForkTip->nHeight < 72)
|
::ChainActive().Height() - pindexNewForkTip->nHeight < 288)
|
||||||
{
|
{
|
||||||
pindexBestForkTip = pindexNewForkTip;
|
pindexBestForkTip = pindexNewForkTip;
|
||||||
pindexBestForkBase = pfork;
|
pindexBestForkBase = pfork;
|
||||||
|
|
Loading…
Reference in a new issue