mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Add -forceibdcomplete and use IBD to allow all-peer headers-sync.
This uses IsInitialBlockDownload to enable headers-fetching from all peers (in addition to the existing recent-headers-tip check). It also adds a hidden flag which allows you to force IBD to false, enabling download from all peers.
This commit is contained in:
parent
f40b9feb2e
commit
253f634396
1 changed files with 3 additions and 1 deletions
|
|
@ -1344,6 +1344,8 @@ CAmount GetBlockValue(int nHeight, const CAmount& nFees)
|
|||
|
||||
bool IsInitialBlockDownload()
|
||||
{
|
||||
if (GetBoolArg("-forceibdcomplete", false))
|
||||
return false;
|
||||
LOCK(cs_main);
|
||||
if (fImporting || fReindex || chainActive.Height() < Checkpoints::GetTotalBlocksEstimate())
|
||||
return true;
|
||||
|
|
@ -4715,7 +4717,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
|
|||
bool fFetch = state.fPreferredDownload || (nPreferredDownload == 0 && !pto->fClient && !pto->fOneShot); // Download if this is a nice peer, or we have no nice peers and this one might do.
|
||||
if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex) {
|
||||
// Only actively request headers from a single peer, unless we're close to today.
|
||||
if ((nSyncStarted == 0 && fFetch) || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) {
|
||||
if ((nSyncStarted == 0 && fFetch) || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60 || !IsInitialBlockDownload()) {
|
||||
state.fSyncStarted = true;
|
||||
nSyncStarted++;
|
||||
CBlockIndex *pindexStart = pindexBestHeader->pprev ? pindexBestHeader->pprev : pindexBestHeader;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue