Skip to content

Commit

Permalink
Merge pull request #1568 from cyrossignol/sync-cleanup
Browse files Browse the repository at this point in the history
Disable quorum for grandfathered blocks to speed up sync
  • Loading branch information
jamescowens committed Oct 16, 2019
2 parents 6dcdc45 + aed9150 commit 2964170
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3413,11 +3413,7 @@ bool SetBestChain(CTxDB& txdb, CBlock &blockNew, CBlockIndex* pindexNew)
boost::thread t(runCommand, strCmd); // thread runs free
}

// Perform Gridcoin services now that w have a new head.
// Remove V9 checks after the V9 switch.
// TODO: ???
if(IsV9Enabled(nBestHeight))
GridcoinServices();
GridcoinServices();

return true;
}
Expand Down Expand Up @@ -3812,10 +3808,6 @@ bool CBlock::AcceptBlock(bool generated_by_me)
//Grandfather
if (nHeight > nGrandfather)
{
// Check that the block chain matches the known block chain up to a checkpoint
if (!Checkpoints::CheckHardened(nHeight, hash))
return DoS(100, error("AcceptBlock() : rejected by hardened checkpoint lock-in at %d", nHeight));

// Enforce rule that the coinbase starts with serialized block height
CScript expect = CScript() << nHeight;
if (vtx[0].vin[0].scriptSig.size() < expect.size() ||
Expand Down Expand Up @@ -3955,19 +3947,21 @@ bool NeedASuperblock()

void GridcoinServices()
{

//Dont do this on headless - SeP
if(fQtActive)
if (fQtActive && (nBestHeight % 125) == 0 && nBestHeight > 0)
{
if ((nBestHeight % 125) == 0)
{
GetGlobalStatus();
bForceUpdate=true;
uiInterface.NotifyBlocksChanged();
}
GetGlobalStatus();
bForceUpdate=true;
uiInterface.NotifyBlocksChanged();
}

// Services thread activity
// Research reward checks are disabled before nGrandfather. There is no
// reason to update quorum state for grandfathered blocks since nothing
// checks that data until after nGrandfather:
//
if (pindexBest->nHeight < nGrandfather) {
return;
}

if(IsV9Enabled_Tally(nBestHeight))
{
Expand Down Expand Up @@ -4017,8 +4011,9 @@ void GridcoinServices()
}

//Dont perform the following functions if out of sync
if (pindexBest->nHeight < nGrandfather || OutOfSyncByAge())
if (OutOfSyncByAge()) {
return;
}

//Backup the wallet once per 900 blocks or as specified in config:
int nWBI = GetArg("-walletbackupinterval", 900);
Expand Down Expand Up @@ -4308,10 +4303,6 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock, bool generated_by_me)

}

// Compatiblity while V8 is in use. Can be removed after the V9 switch.
if(IsV9Enabled(pindexBest->nHeight) == false)
GridcoinServices();

return true;
}

Expand Down

0 comments on commit 2964170

Please sign in to comment.