Skip to content

Commit

Permalink
PPCoin: Fix pausing issues of initial block download
Browse files Browse the repository at this point in the history
        around the latest proof-of-work block
  • Loading branch information
sunnyking committed Aug 7, 2012
1 parent fe90b0f commit 9e9510f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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()));
Expand Down

0 comments on commit 9e9510f

Please sign in to comment.