From: MASM fan Date: Sun, 11 Jan 2015 15:05:12 +0000 (-0800) Subject: Minor optimizations of initial block download. X-Git-Tag: nvc-v0.5.1~10 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=90852995d1c9872f87c9a155c5f6d01fd1a35934 Minor optimizations of initial block download. --- diff --git a/src/main.cpp b/src/main.cpp index 473e5bf..008f209 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1263,13 +1263,14 @@ bool IsInitialBlockDownload() return true; static int64_t nLastUpdate; static CBlockIndex* pindexLastBest; + int64_t nCurrentTime = GetTime(); if (pindexBest != pindexLastBest) { pindexLastBest = pindexBest; - nLastUpdate = GetTime(); + nLastUpdate = nCurrentTime; } - return (GetTime() - nLastUpdate < 10 && - pindexBest->GetBlockTime() < GetTime() - 24 * 60 * 60); + return (nCurrentTime - nLastUpdate < 10 && + pindexBest->GetBlockTime() < nCurrentTime - 24 * 60 * 60); } void static InvalidChainFound(CBlockIndex* pindexNew) @@ -2213,7 +2214,9 @@ bool CBlock::AddToBlockIndex(unsigned int nFile, unsigned int nBlockPos) hashPrevBestCoinBase = vtx[0].GetHash(); } - uiInterface.NotifyBlocksChanged(); + static int8_t counter = 0; + if( (++counter & 0x0F) == 0 || !IsInitialBlockDownload()) // repaint every 16 blocks if not in initial block download + uiInterface.NotifyBlocksChanged(); return true; }