File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -704,7 +704,7 @@ static RPCHelpMan getblocktemplate()
704
704
NodeContext& node = EnsureAnyNodeContext (request.context );
705
705
ChainstateManager& chainman = EnsureChainman (node);
706
706
Mining& miner = EnsureMining (node);
707
- LOCK (cs_main);
707
+ WAIT_LOCK (cs_main, csmain_lock );
708
708
uint256 tip{CHECK_NONFATAL (miner.getTip ()).value ().hash };
709
709
710
710
std::string strMode = " template" ;
@@ -810,8 +810,8 @@ static RPCHelpMan getblocktemplate()
810
810
}
811
811
812
812
// Release lock while waiting
813
- LEAVE_CRITICAL_SECTION (cs_main);
814
813
{
814
+ REVERSE_LOCK (csmain_lock, cs_main);
815
815
MillisecondsDouble checktxtime{std::chrono::minutes (1 )};
816
816
while (IsRPCRunning ()) {
817
817
// If hashWatchedChain is not a real block hash, this will
@@ -830,8 +830,6 @@ static RPCHelpMan getblocktemplate()
830
830
checktxtime = std::chrono::seconds (10 );
831
831
}
832
832
}
833
- ENTER_CRITICAL_SECTION (cs_main);
834
-
835
833
tip = CHECK_NONFATAL (miner.getTip ()).value ().hash ;
836
834
837
835
if (!IsRPCRunning ())
You can’t perform that action at this time.
0 commit comments