This commit is contained in:
Duke Leto
2022-07-04 01:45:05 -04:00
parent 7dfa3f9475
commit 8ca330dc68

View File

@@ -1312,10 +1312,10 @@ void static RandomXMiner()
std::lock_guard<std::mutex> lock{m_cs}; std::lock_guard<std::mutex> lock{m_cs};
return cancelSolver; return cancelSolver;
}; };
// TODO: solver specific stuff
try { try {
// TODO: Convert solution to byte array (decompress) and pass it to validBlock method. // Use the randomX hash as the block solution
std::vector<unsigned char> sol_char(randomxHash, randomxHash+32); // = GetMinimalFromIndices(index_vector, DIGITBITS); std::vector<unsigned char> sol_char(randomxHash, randomxHash+32);
bool found = validBlock(sol_char); bool found = validBlock(sol_char);
if (found) { if (found) {
fprintf(stderr,"RandomXMiner: found solution!\n"); fprintf(stderr,"RandomXMiner: found solution!\n");
@@ -1327,8 +1327,8 @@ void static RandomXMiner()
} }
} catch (RandomXSolverCanceledException&) { } catch (RandomXSolverCanceledException&) {
LogPrintf("HushRandomXMiner solver canceled\n"); LogPrintf("HushRandomXMiner solver canceled\n");
std::lock_guard<std::mutex> lock{m_cs}; std::lock_guard<std::mutex> lock{m_cs};
cancelSolver = false; cancelSolver = false;
} }
boost::this_thread::interruption_point(); boost::this_thread::interruption_point();
@@ -1337,13 +1337,13 @@ void static RandomXMiner()
{ {
if ( Mining_height > ASSETCHAINS_MINHEIGHT ) if ( Mining_height > ASSETCHAINS_MINHEIGHT )
{ {
fprintf(stderr,"no nodes, break\n"); fprintf(stderr,"%s: no nodes, break\n", __func__);
break; break;
} }
} }
if ((UintToArith256(pblock->nNonce) & 0xffff) == 0xffff) if ((UintToArith256(pblock->nNonce) & 0xffff) == 0xffff)
{ {
fprintf(stderr,"nonce & 0xffff == 0xffff, break\n"); fprintf(stderr,"%s: nonce & 0xffff == 0xffff, break\n", __func__);
break; break;
} }
// Update nNonce and nTime // Update nNonce and nTime