Ensure cs_main lock is held when TestBlockValidity() is called

This commit is contained in:
Duke
2024-09-12 19:47:42 -04:00
parent 04165e161a
commit 8b0c0493ac

View File

@@ -1334,6 +1334,8 @@ void static RandomXMiner()
}
CValidationState state;
{ LOCK(cs_main);
if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false))
{
h = UintToArith256(B.GetHash());
@@ -1344,6 +1346,8 @@ void static RandomXMiner()
fprintf(stderr,"\n");
return(false);
}
}
SetThreadPriority(THREAD_PRIORITY_NORMAL);
LogPrintf("HushRandomXMiner:\n");
LogPrintf("proof-of-work found \n hash: %s \ntarget: %s\n", B.GetHash().GetHex(), HASHTarget.GetHex());
@@ -1702,6 +1706,8 @@ void static BitcoinMiner()
fprintf(stderr," mined %s block %d!\n",SMART_CHAIN_SYMBOL,Mining_height);
}
CValidationState state;
{ LOCK(cs_main);
if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false))
{
h = UintToArith256(B.GetHash());
@@ -1711,6 +1717,8 @@ void static BitcoinMiner()
gotinvalid = 1;
return(false);
}
}
HUSH_CHOSEN_ONE = 1;
// Found a solution
SetThreadPriority(THREAD_PRIORITY_NORMAL);