This commit is contained in:
jl777
2018-04-19 14:17:47 +03:00
parent f8f740a966
commit 8fbee9292d
3 changed files with 8 additions and 11 deletions

View File

@@ -3786,6 +3786,8 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat
//if ( !CheckEquihashSolution(&block, Params()) )
// return state.DoS(100, error("CheckBlock: Equihash solution invalid"),REJECT_INVALID, "invalid-solution");
komodo_block2pubkey33(pubkey33,(CBlock *)&block);
if ( !CheckProofOfWork(height,pubkey33,blockhdr.GetHash(),block.nBits,Params().GetConsensus(),block.nTime) )
return state.DoS(50, error("CheckBlock: proof of work failed"),REJECT_INVALID, "high-hash");
if ( komodo_checkPOW(1,(CBlock *)&block,height) < 0 ) // checks Equihash
return state.DoS(100, error("CheckBlock: failed slow_checkPOW"),REJECT_INVALID, "failed-slow_checkPOW");
}
@@ -4144,22 +4146,22 @@ bool TestBlockValidity(CValidationState &state, const CBlock& block, CBlockIndex
// NOTE: CheckBlockHeader is called by CheckBlock
if (!ContextualCheckBlockHeader(block, state, pindexPrev))
{
fprintf(stderr,"TestBlockValidity failure A\n");
fprintf(stderr,"TestBlockValidity failure A checkPOW.%d\n",fCheckPOW);
return false;
}
if (!CheckBlock(indexDummy.nHeight,0,block, state, verifier, fCheckPOW, fCheckMerkleRoot))
{
fprintf(stderr,"TestBlockValidity failure B\n");
fprintf(stderr,"TestBlockValidity failure B checkPOW.%d\n",fCheckPOW);
return false;
}
if (!ContextualCheckBlock(block, state, pindexPrev))
{
fprintf(stderr,"TestBlockValidity failure C\n");
fprintf(stderr,"TestBlockValidity failure C checkPOW.%d\n",fCheckPOW);
return false;
}
if (!ConnectBlock(block, state, &indexDummy, viewNew, true,fCheckPOW))
{
fprintf(stderr,"TestBlockValidity failure D\n");
fprintf(stderr,"TestBlockValidity failure D checkPOW.%d\n",fCheckPOW);
return false;
}
assert(state.IsValid());