This commit is contained in:
jl777
2017-03-13 12:40:09 +02:00
parent 925971c0cd
commit bd6ef155c6

View File

@@ -698,7 +698,7 @@ void static BitcoinMiner(CWallet *pwallet)
crypto_generichash_blake2b_update(&curr_state,pblock->nNonce.begin(),pblock->nNonce.size()); crypto_generichash_blake2b_update(&curr_state,pblock->nNonce.begin(),pblock->nNonce.size());
// (x_1, x_2, ...) = A(I, V, n, k) // (x_1, x_2, ...) = A(I, V, n, k)
LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString()); LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString());
//fprintf(stderr,"running solver\n"); fprintf(stderr,"running solver\n");
std::function<bool(std::vector<unsigned char>)> validBlock = std::function<bool(std::vector<unsigned char>)> validBlock =
[&pblock, &hashTarget, &pwallet, &reservekey, &m_cs, &cancelSolver, &chainparams] [&pblock, &hashTarget, &pwallet, &reservekey, &m_cs, &cancelSolver, &chainparams]
(std::vector<unsigned char> soln) (std::vector<unsigned char> soln)
@@ -709,13 +709,13 @@ void static BitcoinMiner(CWallet *pwallet)
solutionTargetChecks.increment(); solutionTargetChecks.increment();
if ( UintToArith256(pblock->GetHash()) > hashTarget ) if ( UintToArith256(pblock->GetHash()) > hashTarget )
{ {
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) //if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"missed target\n"); fprintf(stderr,"missed target\n");
return false; return false;
} }
if ( ASSETCHAINS_SYMBOL[0] == 0 && Mining_start != 0 && time(NULL) < Mining_start+ROUNDROBIN_DELAY ) if ( ASSETCHAINS_SYMBOL[0] == 0 && Mining_start != 0 && time(NULL) < Mining_start+ROUNDROBIN_DELAY )
{ {
//printf("Round robin diff sleep %d\n",(int32_t)(Mining_start+ROUNDROBIN_DELAY-time(NULL))); printf("Round robin diff sleep %d\n",(int32_t)(Mining_start+ROUNDROBIN_DELAY-time(NULL)));
int32_t nseconds = Mining_start+ROUNDROBIN_DELAY-time(NULL); int32_t nseconds = Mining_start+ROUNDROBIN_DELAY-time(NULL);
if ( nseconds > 0 ) if ( nseconds > 0 )
sleep(nseconds); sleep(nseconds);
@@ -815,25 +815,25 @@ void static BitcoinMiner(CWallet *pwallet)
{ {
if ( ASSETCHAINS_SYMBOL[0] == 0 || Mining_height > ASSETCHAINS_MINHEIGHT ) if ( ASSETCHAINS_SYMBOL[0] == 0 || Mining_height > ASSETCHAINS_MINHEIGHT )
{ {
//fprintf(stderr,"no nodes, break\n"); fprintf(stderr,"no nodes, break\n");
break; break;
} }
} }
if ((UintToArith256(pblock->nNonce) & 0xffff) == 0xffff) if ((UintToArith256(pblock->nNonce) & 0xffff) == 0xffff)
{ {
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) //if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"0xffff, break\n"); fprintf(stderr,"0xffff, break\n");
break; break;
} }
if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 60) if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 60)
{ {
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) //if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"timeout, break\n"); fprintf(stderr,"timeout, break\n");
break; break;
} }
if ( pindexPrev != chainActive.Tip() ) if ( pindexPrev != chainActive.Tip() )
{ {
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) //if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"Tip advanced, break\n"); fprintf(stderr,"Tip advanced, break\n");
break; break;
} }