Mining fix

This commit is contained in:
jl777
2018-04-16 08:56:27 +03:00
parent bea77378f9
commit b95368bf87
2 changed files with 9 additions and 10 deletions

View File

@@ -3509,7 +3509,7 @@ 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()) )
/*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
@@ -3568,12 +3568,11 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat
fprintf(stderr,"checkblockheader error PoW.%d\n",fCheckPOW);
return false;
}
if ( fCheckPOW && !CheckEquihashSolution(&block, Params()) )
return state.DoS(100, error("CheckBlockHeader(): 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);
return state.DoS(1, error("CheckBlock(): proof of work failed"),REJECT_INVALID, "high-hash");
}
// Check the merkle root.
if (fCheckMerkleRoot) {
bool mutated;

View File

@@ -918,6 +918,12 @@ void static BitcoinMiner()
// fprintf(stderr," missed target\n");
return false;
}
CValidationState state;
if ( !TestBlockValidity(state, *pblock, chainActive.Tip(), true, false))
{
fprintf(stderr,"Invalid block mined, try again\n");
return(false);
}
if ( ASSETCHAINS_STAKED == 0 )
{
if ( Mining_start != 0 && time(NULL) < Mining_start+roundrobin_delay )
@@ -935,12 +941,6 @@ void static BitcoinMiner()
}
else
{
CValidationState state;
if ( !TestBlockValidity(state, *pblock, chainActive.Tip(), true, false))
{
fprintf(stderr,"Invalid block mined, try again\n");
return(false);
}
if ( NOTARY_PUBKEY33[0] != 0 )
{
printf("need to wait %d seconds to submit\n",(int32_t)(pblock->nTime - GetAdjustedTime()));