Skip to content

Instantly share code, notes, and snippets.

@orphanate
Created June 13, 2014 12:47
Show Gist options
  • Select an option

  • Save orphanate/47db0ff19d19398b53e7 to your computer and use it in GitHub Desktop.

Select an option

Save orphanate/47db0ff19d19398b53e7 to your computer and use it in GitHub Desktop.
// 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