Skip to content

Instantly share code, notes, and snippets.

@orphanate
Created June 13, 2014 14:55
Show Gist options
  • Select an option

  • Save orphanate/9ec588bbe8211fefa91c to your computer and use it in GitHub Desktop.

Select an option

Save orphanate/9ec588bbe8211fefa91c to your computer and use it in GitHub Desktop.
/*
if (pcheckpoint && pblock->hashPrevBlock != hashBestChain && !Checkpoints::WantedByPendingSyncCheckpoint(hash))
{
// Extra checks to prevent "fill up memory by spamming with bogus blocks"
int64_t deltaTime = pblock->GetBlockTime() - pcheckpoint->nTime;
CBigNum bnNewBlock;
bnNewBlock.SetCompact(pblock->nBits);
CBigNum bnRequired;
if (pblock->IsProofOfStake())
bnRequired.SetCompact(ComputeMinStake(GetLastBlockIndex(pcheckpoint, true)->nBits, deltaTime, pblock->nTime));
else
bnRequired.SetCompact(ComputeMinWork(GetLastBlockIndex(pcheckpoint, false)->nBits, deltaTime));
if (bnNewBlock > bnRequired)
{
if (pfrom)
pfrom->Misbehaving(100);
// return error("ProcessBlock() : block with too little %s", pblock->IsProofOfStake()? "proof-of-stake" : "proof-of-work");
return error("ProcessBlock() : block with too little %s bnNewBlock %s bnRequired %s",
pblock->IsProofOfStake()? "proof-of-stake" : "proof-of-work",
bnNewBlock.ToString().c_str(), bnRequired.ToString().c_str());
}
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment