From: Sunny King Date: Tue, 7 Aug 2012 19:10:11 +0000 (+0100) Subject: PPCoin: Fix pausing issues of initial block download X-Git-Tag: v0.4.0-unstable~107 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=9e9510fce6ceb5d9d8409fe161c8116615382efa PPCoin: Fix pausing issues of initial block download around the latest proof-of-work block --- diff --git a/src/main.cpp b/src/main.cpp index e01be20..b60eac0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2064,7 +2064,8 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock) pfrom->PushGetBlocks(pindexBest, GetOrphanRoot(pblock2)); // ppcoin: getblocks may not obtain the ancestor block rejected // earlier by duplicate-stake check so we ask for it again directly - pfrom->AskFor(CInv(MSG_BLOCK, WantedByOrphan(pblock2))); + if (!IsInitialBlockDownload()) + pfrom->AskFor(CInv(MSG_BLOCK, WantedByOrphan(pblock2))); } return true; } @@ -2909,6 +2910,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (pindex->GetBlockHash() == hashStop) { printf(" getblocks stopping at %d %s (%u bytes)\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str(), nBytes); + // ppcoin: tell downloading node about the latest block if it's + // without risk being rejected due to stake connection check + if (hashStop != hashBestChain && pindex->GetBlockTime() + STAKE_MIN_AGE > pindexBest->GetBlockTime()) + pfrom->PushInventory(CInv(MSG_BLOCK, hashBestChain)); break; } pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash()));