This commit is contained in:
jl777
2018-04-19 15:33:36 +03:00
parent 2ae7e0b5fa
commit c21c630657

View File

@@ -884,9 +884,6 @@ void static BitcoinMiner()
if ( NOTARY_PUBKEY33[0] == 0 && ASSETCHAINS_STAKED > 0 && ASSETCHAINS_STAKED < 100 ) if ( NOTARY_PUBKEY33[0] == 0 && ASSETCHAINS_STAKED > 0 && ASSETCHAINS_STAKED < 100 )
hashTarget = HASHTarget_POW; hashTarget = HASHTarget_POW;
else hashTarget = HASHTarget; else hashTarget = HASHTarget;
//int32_t z; for (z=31; z>=0; z--)
// fprintf(stderr,"%02x",((uint8_t *)&hashTarget)[z]);
//fprintf(stderr," running solver\n");
std::function<bool(std::vector<unsigned char>)> validBlock = std::function<bool(std::vector<unsigned char>)> validBlock =
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
[&pblock, &hashTarget, &pwallet, &reservekey, &m_cs, &cancelSolver, &chainparams] [&pblock, &hashTarget, &pwallet, &reservekey, &m_cs, &cancelSolver, &chainparams]
@@ -894,22 +891,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; int32_t z; arith_uint256 h; CBlock B;
// Write the solution to the hash and compute the result. // Write the solution to the hash and compute the result.
B = *pblock;
h = UintToArith256(B.GetHash());
for (z=31; z>=0; z--)
fprintf(stderr,"%02x",((uint8_t *)&hashTarget)[z]);
fprintf(stderr," running solver\n");
LogPrint("pow", "- Checking solution against target\n"); LogPrint("pow", "- Checking solution against target\n");
pblock->nSolution = soln; pblock->nSolution = soln;
solutionTargetChecks.increment(); solutionTargetChecks.increment();
h = UintToArith256(pblock->GetHash()); h = UintToArith256(B.GetHash());
if ( NOTARY_PUBKEY33[0] == 0 && ASSETCHAINS_STAKED > 0 && ASSETCHAINS_STAKED < 100 ) for (z=31; z>=0; z--)
{ fprintf(stderr,"%02x",((uint8_t *)&hashTarget)[z]);
if ( h > HASHTarget_POW ) fprintf(stderr," running solver2\n");
return false; if ( h > hashTarget )
} return false;
else
{
if ( h > HASHTarget )
return false;
}
for (z=31; z>=16; z--) for (z=31; z>=16; z--)
fprintf(stderr,"%02x",((uint8_t *)&h)[z]); fprintf(stderr,"%02x",((uint8_t *)&h)[z]);
fprintf(stderr," mined "); fprintf(stderr," mined ");
@@ -920,9 +917,9 @@ void static BitcoinMiner()
fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]); fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]);
fprintf(stderr," POW\n"); fprintf(stderr," POW\n");
CValidationState state; CValidationState state;
if ( !TestBlockValidity(state, *pblock, chainActive.Tip(), true, false)) if ( !TestBlockValidity(state,B, chainActive.Tip(), true, false))
{ {
h = UintToArith256(pblock->GetHash()); h = UintToArith256(B.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");