Ensure cs_main lock is held when TestBlockValidity() is called
This commit is contained in:
@@ -1334,6 +1334,8 @@ void static RandomXMiner()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CValidationState state;
|
CValidationState state;
|
||||||
|
{ LOCK(cs_main);
|
||||||
|
|
||||||
if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false))
|
if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false))
|
||||||
{
|
{
|
||||||
h = UintToArith256(B.GetHash());
|
h = UintToArith256(B.GetHash());
|
||||||
@@ -1344,6 +1346,8 @@ void static RandomXMiner()
|
|||||||
fprintf(stderr,"\n");
|
fprintf(stderr,"\n");
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
SetThreadPriority(THREAD_PRIORITY_NORMAL);
|
SetThreadPriority(THREAD_PRIORITY_NORMAL);
|
||||||
LogPrintf("HushRandomXMiner:\n");
|
LogPrintf("HushRandomXMiner:\n");
|
||||||
LogPrintf("proof-of-work found \n hash: %s \ntarget: %s\n", B.GetHash().GetHex(), HASHTarget.GetHex());
|
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);
|
fprintf(stderr," mined %s block %d!\n",SMART_CHAIN_SYMBOL,Mining_height);
|
||||||
}
|
}
|
||||||
CValidationState state;
|
CValidationState state;
|
||||||
|
{ LOCK(cs_main);
|
||||||
|
|
||||||
if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false))
|
if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false))
|
||||||
{
|
{
|
||||||
h = UintToArith256(B.GetHash());
|
h = UintToArith256(B.GetHash());
|
||||||
@@ -1711,6 +1717,8 @@ void static BitcoinMiner()
|
|||||||
gotinvalid = 1;
|
gotinvalid = 1;
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
HUSH_CHOSEN_ONE = 1;
|
HUSH_CHOSEN_ONE = 1;
|
||||||
// Found a solution
|
// Found a solution
|
||||||
SetThreadPriority(THREAD_PRIORITY_NORMAL);
|
SetThreadPriority(THREAD_PRIORITY_NORMAL);
|
||||||
|
|||||||
Reference in New Issue
Block a user