printf("ProcessSyncCheckpoint: pending for sync-checkpoint %s\n", hashCheckpoint.ToString().c_str());
// Ask this guy to fill in what we're missing
if (pfrom)
+ {
pfrom->PushGetBlocks(pindexBest, hashCheckpoint);
+ // ask directly as well in case rejected earlier by duplicate
+ // proof-of-stake because getblocks may not get it this time
+ pfrom->AskFor(CInv(MSG_BLOCK, mapOrphanBlocks.count(hashCheckpoint)? GetOrphanRoot(mapOrphanBlocks[hashCheckpoint]) : hashCheckpoint));
+ }
return false;
}
return true;
}
-uint256 static GetOrphanRoot(const CBlock* pblock)
+uint256 GetOrphanRoot(const CBlock* pblock)
{
// Work back to the first block in the orphan chain
while (mapOrphanBlocks.count(pblock->hashPrevBlock))
if (pfrom)
{
pfrom->PushGetBlocks(pindexBest, GetOrphanRoot(pblock2));
- // ppcoin: getblocks may not obtain the parent block rejected earlier
- // by duplicate-stake check so we must ask for it again directly
- if (!mapOrphanBlocks.count(pblock->hashPrevBlock))
- pfrom->AskFor(CInv(MSG_BLOCK, pblock->hashPrevBlock));
+ // 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, GetOrphanRoot(pblock2)));
}
return true;
}
extern int64 nTimeBestReceived;
extern CCriticalSection cs_setpwalletRegistered;
extern std::set<CWallet*> setpwalletRegistered;
+extern std::map<uint256, CBlock*> mapOrphanBlocks;
// Settings
extern int fGenerateBitcoins;
bool IsInitialBlockDownload();
std::string GetWarnings(std::string strFor);
bool Reorganize(CTxDB& txdb, CBlockIndex* pindexNew);
-
+uint256 GetOrphanRoot(const CBlock* pblock);