diff options
| author | Pieter Wuille <[email protected]> | 2018-03-20 21:04:27 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2018-04-03 21:53:27 -0700 |
| commit | 45dd13503918e75a45ce33eb5c934b998790fdc8 (patch) | |
| tree | d5febb2553c79a1dbedcfbf1eccc4c1ec99133a5 /src/validation.cpp | |
| parent | Merge #12846: [moveonly] Extract HelpRequested to dry up the help options tes... (diff) | |
| download | discoin-45dd13503918e75a45ce33eb5c934b998790fdc8.tar.xz discoin-45dd13503918e75a45ce33eb5c934b998790fdc8.zip | |
Fix csBestBlock/cvBlockChange waiting in rpc/mining
Diffstat (limited to 'src/validation.cpp')
| -rw-r--r-- | src/validation.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index df8729e38..c3e411f1f 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -204,6 +204,7 @@ CChain& chainActive = g_chainstate.chainActive; CBlockIndex *pindexBestHeader = nullptr; CWaitableCriticalSection csBestBlock; CConditionVariable cvBlockChange; +uint256 hashBestBlock; int nScriptCheckThreads = 0; std::atomic_bool fImporting(false); std::atomic_bool fReindex(false); @@ -2195,7 +2196,11 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar // New best block mempool.AddTransactionsUpdated(1); - cvBlockChange.notify_all(); + { + WaitableLock lock(csBestBlock); + hashBestBlock = pindexNew->GetBlockHash(); + cvBlockChange.notify_all(); + } std::vector<std::string> warningMessages; if (!IsInitialBlockDownload()) |