aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/mining.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-04-12 18:13:49 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-04-12 18:25:44 -0700
commit4ba6da55743a55189164e29e45ac9e73a074d808 (patch)
tree993294d94c6d8c068e7727b32192b98ba395bd15 /src/rpc/mining.cpp
parent8480d41e0f9d466447f49bf5dd7c17c5337af77a (diff)
parent4a6c0e3dcfdca98270cb96b73db4c3d4446dba50 (diff)
downloadbitcoin-4ba6da55743a55189164e29e45ac9e73a074d808.tar.xz
Merge #12743: Fix csBestBlock/cvBlockChange waiting in rpc/mining
4a6c0e3dcf Modernize best block mutex/cv/hash variable naming (Pieter Wuille) 45dd135039 Fix csBestBlock/cvBlockChange waiting in rpc/mining (Pieter Wuille) Pull request description: This is an alternative to #11694. It reintroduces a uint256 variable with the best block hash, protected by csBestBlock, and only updated while holding it. Also rename the involved variable to modern guidelines, as there are very few uses. Tree-SHA512: 826a86c7d3cee7fe49f99f4398ae99e81cb0563197eaeba77306a3ca6072b67cdb932bc35720fc0f99c2a57b218efa029d0b8bdfb240591a629b2e90efa3199d
Diffstat (limited to 'src/rpc/mining.cpp')
-rw-r--r--src/rpc/mining.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
index 75bc983200..9a7c4b8e6d 100644
--- a/src/rpc/mining.cpp
+++ b/src/rpc/mining.cpp
@@ -471,10 +471,10 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
{
checktxtime = std::chrono::steady_clock::now() + std::chrono::minutes(1);
- WaitableLock lock(csBestBlock);
- while (chainActive.Tip()->GetBlockHash() == hashWatchedChain && IsRPCRunning())
+ WaitableLock lock(g_best_block_mutex);
+ while (g_best_block == hashWatchedChain && IsRPCRunning())
{
- if (cvBlockChange.wait_until(lock, checktxtime) == std::cv_status::timeout)
+ if (g_best_block_cv.wait_until(lock, checktxtime) == std::cv_status::timeout)
{
// Timeout: Check transactions for update
if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLastLP)