From 45dd13503918e75a45ce33eb5c934b998790fdc8 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 20 Mar 2018 21:04:27 -0700 Subject: Fix csBestBlock/cvBlockChange waiting in rpc/mining --- src/rpc/mining.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/rpc') diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 06882c0dfd..5a5ff06fe3 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -471,7 +471,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request) checktxtime = std::chrono::steady_clock::now() + std::chrono::minutes(1); WaitableLock lock(csBestBlock); - while (chainActive.Tip()->GetBlockHash() == hashWatchedChain && IsRPCRunning()) + while (hashBestBlock == hashWatchedChain && IsRPCRunning()) { if (cvBlockChange.wait_until(lock, checktxtime) == std::cv_status::timeout) { -- cgit v1.2.3 From 4a6c0e3dcfdca98270cb96b73db4c3d4446dba50 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 3 Apr 2018 21:53:07 -0700 Subject: Modernize best block mutex/cv/hash variable naming --- src/rpc/mining.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/rpc') diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 5a5ff06fe3..fbdcc3b4dd 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -470,10 +470,10 @@ UniValue getblocktemplate(const JSONRPCRequest& request) { checktxtime = std::chrono::steady_clock::now() + std::chrono::minutes(1); - WaitableLock lock(csBestBlock); - while (hashBestBlock == 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) -- cgit v1.2.3