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