Browse Source

Move equihash to check block

pull/4/head
jl777 6 years ago
parent
commit
ba6c9a5a47
  1. 9
      src/main.cpp

9
src/main.cpp

@ -3509,8 +3509,8 @@ bool CheckBlockHeader(int32_t height,CBlockIndex *pindex, const CBlockHeader& bl
// return state.DoS(100, error("CheckBlockHeader(): block version too low"),REJECT_INVALID, "version-too-low");
// Check Equihash solution is valid
if ( fCheckPOW && !CheckEquihashSolution(&blockhdr, Params()) )
return state.DoS(100, error("CheckBlockHeader(): Equihash solution invalid"),REJECT_INVALID, "invalid-solution");
/*if ( fCheckPOW && !CheckEquihashSolution(&blockhdr, Params()) )
return state.DoS(100, error("CheckBlockHeader(): Equihash solution invalid"),REJECT_INVALID, "invalid-solution");*/
// Check proof of work matches claimed amount
/*komodo_index2pubkey33(pubkey33,pindex,height);
@ -3565,11 +3565,12 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat
// redundant with the call in AcceptBlockHeader.
if (!CheckBlockHeader(height,pindex,block,state,fCheckPOW))
return false;
//komodo_index2pubkey33(pubkey33,pindex,height);
if ( fCheckPOW && !CheckEquihashSolution(&blockhdr, Params()) )
return state.DoS(100, error("CheckBlock(): Equihash solution invalid"),REJECT_INVALID, "invalid-solution");
komodo_block2pubkey33(pubkey33,(CBlock *)&block);
if ( fCheckPOW && !CheckProofOfWork(height,pubkey33,block.GetHash(), block.nBits, Params().GetConsensus()) )
{
komodo_reverify_blockcheck(state,height,pindex);
//komodo_reverify_blockcheck(state,height,pindex);
return state.DoS(1, error("CheckBlock(): proof of work failed"),REJECT_INVALID, "high-hash");
}
// Check the merkle root.

Loading…
Cancel
Save