This commit is contained in:
jl777
2018-04-18 22:07:22 +03:00
parent f8ef6ca931
commit a9550b923b

View File

@@ -913,20 +913,22 @@ void static BitcoinMiner()
[&pblock, &hashTarget, &m_cs, &cancelSolver, &chainparams] [&pblock, &hashTarget, &m_cs, &cancelSolver, &chainparams]
#endif #endif
(std::vector<unsigned char> soln) { (std::vector<unsigned char> soln) {
int32_t z; arith_uint256 h = UintToArith256(pblock->GetHash());
// Write the solution to the hash and compute the result. // Write the solution to the hash and compute the result.
LogPrint("pow", "- Checking solution against target\n"); LogPrint("pow", "- Checking solution against target\n");
pblock->nSolution = soln; pblock->nSolution = soln;
solutionTargetChecks.increment(); solutionTargetChecks.increment();
if ( UintToArith256(pblock->GetHash()) > HASHTarget ) for (z=31; z>=0; z--)
fprintf(stderr,"%02x",((uint8_t *)&h)[z]);
if ( h > HASHTarget )
{ {
//if ( ASSETCHAINS_SYMBOL[0] != 0 ) fprintf(stderr," missed target\n");
// fprintf(stderr," missed target\n");
return false; return false;
} }
fprintf(stderr," mined hash\n");
CValidationState state; CValidationState state;
if ( !TestBlockValidity(state, *pblock, chainActive.Tip(), true, false)) if ( !TestBlockValidity(state, *pblock, chainActive.Tip(), true, false))
{ {
int32_t z; uint256 h = pblock->GetHash();
for (z=31; z>=0; z--) for (z=31; z>=0; z--)
fprintf(stderr,"%02x",((uint8_t *)&h)[z]); fprintf(stderr,"%02x",((uint8_t *)&h)[z]);
fprintf(stderr," Invalid block mined, try again\n"); fprintf(stderr," Invalid block mined, try again\n");