diff --git a/src/main.cpp b/src/main.cpp index ae5e27916..169124334 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,7 @@ #include "net.h" #include "netmessagemaker.h" #include "pow.h" +#include "time.h" #include "script/interpreter.h" #include "txdb.h" #include "txmempool.h" @@ -4333,7 +4334,15 @@ bool ActivateBestChain(bool fSkipdpow, CValidationState &state, CBlock *pblock) CBlockIndex *pindexMostWork = NULL; const CChainParams& chainParams = Params(); do { - boost::this_thread::interruption_point(); + // Sleep briefly to allow other threads a chance at grabbing cs_main if + // we are connecting a long chain of blocks and would otherwise hold the + // lock almost continuously. This helps + // the internal wallet, if it is enabled, to keep up with the connected + // blocks, reducing the overall time until the node becomes usable. + // + // This is defined to be an interruption point. + // + boost::this_thread::sleep_for(boost::chrono::microseconds(200)); if (ShutdownRequested()) break;