Fix Windows shutdown hang and register console ctrl handler

- Remove GenerateBitcoins(false) from stop RPC handler because it calls
  minerThreads->join_all() which blocks the RPC thread, preventing the
  response from being sent back to the client. Miners are already stopped
  in Shutdown() so this was redundant.
- Add ShutdownRequested() checks in miner peer-wait and nonce loops
- Register SetConsoleCtrlHandler on Windows for clean Ctrl+C/close
- Add check_and_clean_target for --linux-release builds
This commit is contained in:
dan_s
2026-02-23 12:11:55 -06:00
parent 70d97d887b
commit e4e22abf4c
4 changed files with 14 additions and 7 deletions

View File

@@ -34,6 +34,7 @@
#include "RandomX/src/randomx.h"
#endif
#include "hash.h"
#include "init.h"
#include "key_io.h"
#include "main.h"
#include "metrics.h"
@@ -1302,6 +1303,8 @@ void static RandomXMiner()
}
if (!fvNodesEmpty )//&& !IsInitialBlockDownload())
break;
if (ShutdownRequested())
throw boost::thread_interrupted();
MilliSleep(15000);
//fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,SMART_CHAIN_SYMBOL,(int32_t)IsInitialBlockDownload());
@@ -1570,6 +1573,8 @@ void static RandomXMiner()
}
boost::this_thread::interruption_point();
if (ShutdownRequested())
throw boost::thread_interrupted();
if (vNodes.empty() && chainparams.MiningRequiresPeers())
{
@@ -1702,6 +1707,8 @@ void static BitcoinMiner()
}
if (!fvNodesEmpty )//&& !IsInitialBlockDownload())
break;
if (ShutdownRequested())
throw boost::thread_interrupted();
MilliSleep(15000);
//fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,SMART_CHAIN_SYMBOL,(int32_t)IsInitialBlockDownload());