threading: use a reverse lock rather than manual critsect macros

No functional change.
This commit is contained in:
Cory Fields committed 2025-08-22 14:25:39 +00:00
1 parent 3ddd554d31
commit 0d0e0a39b4
1 file changed
+2 -4
+2 -4
View File
@@ -704,7 +704,7 @@ static RPCHelpMan getblocktemplate()
NodeContext& node = EnsureAnyNodeContext(request.context);
ChainstateManager& chainman = EnsureChainman(node);
Mining& miner = EnsureMining(node);
LOCK(cs_main);
WAIT_LOCK(cs_main, csmain_lock);
uint256 tip{CHECK_NONFATAL(miner.getTip()).value().hash};
std::string strMode = "template";
@@ -810,8 +810,8 @@ static RPCHelpMan getblocktemplate()
}
// Release lock while waiting
LEAVE_CRITICAL_SECTION(cs_main);
{
REVERSE_LOCK(csmain_lock, cs_main);
MillisecondsDouble checktxtime{std::chrono::minutes(1)};
while (IsRPCRunning()) {
// If hashWatchedChain is not a real block hash, this will
@@ -830,8 +830,6 @@ static RPCHelpMan getblocktemplate()
checktxtime = std::chrono::seconds(10);
}
}
ENTER_CRITICAL_SECTION(cs_main);
tip = CHECK_NONFATAL(miner.getTip()).value().hash;
if (!IsRPCRunning())