more debug
This commit is contained in:
@@ -1119,7 +1119,7 @@ void static RandomXMiner()
|
||||
}
|
||||
}
|
||||
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
|
||||
fprintf(stderr,"Running HushRandomXMiner with %u transactions in block\n",(int32_t)pblock->vtx.size());
|
||||
fprintf(stderr,"RandomXMiner: %u transactions in block\n",(int32_t)pblock->vtx.size());
|
||||
LogPrintf("Running HushRandomXMiner with %u transactions in block (%u bytes)\n",pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION));
|
||||
|
||||
// Search
|
||||
@@ -1138,7 +1138,7 @@ void static RandomXMiner()
|
||||
break;
|
||||
hush_longestchain();
|
||||
|
||||
LogPrint("pow", "Running RandomX solver with nNonce = %s\n",pblock->nNonce.ToString());
|
||||
fprintf(stderr,"RandomXMiner: solving with nNonce = %s\n",pblock->nNonce.ToString().c_str());
|
||||
arith_uint256 hashTarget;
|
||||
hashTarget = HASHTarget;
|
||||
|
||||
@@ -1236,13 +1236,20 @@ void static RandomXMiner()
|
||||
(std::vector<unsigned char> soln) {
|
||||
int32_t z; arith_uint256 h; CBlock B;
|
||||
// Write the solution to the hash and compute the result.
|
||||
LogPrint("pow", "- Checking solution against target\n");
|
||||
fprintf(stderr,"RandomXMiner: Checking solution against target\n");
|
||||
pblock->nSolution = soln;
|
||||
solutionTargetChecks.increment();
|
||||
B = *pblock;
|
||||
h = UintToArith256(B.GetHash());
|
||||
if ( h > hashTarget )
|
||||
{
|
||||
fprintf(stderr,"RandomXMiner: h > hashTarget h=");
|
||||
for (z=31; z>=0; z--)
|
||||
fprintf(stderr,"%02x",((uint8_t *)&h)[z]);
|
||||
fprintf(stderr," , hashTarget=");
|
||||
for (z=31; z>=0; z--)
|
||||
fprintf(stderr,"%02x",((uint8_t *)&hashTarget)[z]);
|
||||
fprintf(stderr,"\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1250,10 +1257,11 @@ void static RandomXMiner()
|
||||
if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false))
|
||||
{
|
||||
h = UintToArith256(B.GetHash());
|
||||
//for (z=31; z>=0; z--)
|
||||
// fprintf(stderr,"%02x",((uint8_t *)&h)[z]);
|
||||
fprintf(stderr,"Invalid randomx block mined, try again\n");
|
||||
fprintf(stderr,"RandomXMiner: Invalid randomx block mined, try again ");
|
||||
for (z=31; z>=0; z--)
|
||||
fprintf(stderr,"%02x",((uint8_t *)&h)[z]);
|
||||
gotinvalid = 1;
|
||||
fprintf(stderr,"\n");
|
||||
return(false);
|
||||
}
|
||||
SetThreadPriority(THREAD_PRIORITY_NORMAL);
|
||||
@@ -1284,7 +1292,7 @@ void static RandomXMiner()
|
||||
// TODO: solver specific stuff
|
||||
try {
|
||||
// TODO: Convert solution to byte array (decompress) and pass it to validBlock method.
|
||||
std::vector<unsigned char> sol_char; // = GetMinimalFromIndices(index_vector, DIGITBITS);
|
||||
std::vector<unsigned char> sol_char(randomxHash, randomxHash+32); // = GetMinimalFromIndices(index_vector, DIGITBITS);
|
||||
bool found = validBlock(sol_char);
|
||||
if (found) {
|
||||
LogPrintf("HushRandomXMiner found solution!\n");
|
||||
@@ -1292,7 +1300,7 @@ void static RandomXMiner()
|
||||
// because they become invalid as we created a new block in blockchain.
|
||||
break;
|
||||
} else {
|
||||
fprintf(stderr,"HushRandomXMiner solution not found, validBlock=false");
|
||||
fprintf(stderr,"HushRandomXMiner: solution not found, validBlock=false\n");
|
||||
}
|
||||
} catch (RandomXSolverCanceledException&) {
|
||||
LogPrintf("HushRandomXMiner solver canceled\n");
|
||||
|
||||
Reference in New Issue
Block a user