Skip to content

Commit 4a6c0e3

Browse files
committed
Modernize best block mutex/cv/hash variable naming
1 parent 45dd135 commit 4a6c0e3

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ void OnRPCStopped()
307307
{
308308
uiInterface.NotifyBlockTip.disconnect(&RPCNotifyBlockChange);
309309
RPCNotifyBlockChange(false, nullptr);
310-
cvBlockChange.notify_all();
310+
g_best_block_cv.notify_all();
311311
LogPrint(BCLog::RPC, "RPC stopped.\n");
312312
}
313313

src/rpc/mining.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,10 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
470470
{
471471
checktxtime = std::chrono::steady_clock::now() + std::chrono::minutes(1);
472472

473-
WaitableLock lock(csBestBlock);
474-
while (hashBestBlock == hashWatchedChain && IsRPCRunning())
473+
WaitableLock lock(g_best_block_mutex);
474+
while (g_best_block == hashWatchedChain && IsRPCRunning())
475475
{
476-
if (cvBlockChange.wait_until(lock, checktxtime) == std::cv_status::timeout)
476+
if (g_best_block_cv.wait_until(lock, checktxtime) == std::cv_status::timeout)
477477
{
478478
// Timeout: Check transactions for update
479479
if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLastLP)

src/validation.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ CCriticalSection cs_main;
202202
BlockMap& mapBlockIndex = g_chainstate.mapBlockIndex;
203203
CChain& chainActive = g_chainstate.chainActive;
204204
CBlockIndex *pindexBestHeader = nullptr;
205-
CWaitableCriticalSection csBestBlock;
206-
CConditionVariable cvBlockChange;
207-
uint256 hashBestBlock;
205+
CWaitableCriticalSection g_best_block_mutex;
206+
CConditionVariable g_best_block_cv;
207+
uint256 g_best_block;
208208
int nScriptCheckThreads = 0;
209209
std::atomic_bool fImporting(false);
210210
std::atomic_bool fReindex(false);
@@ -2197,9 +2197,9 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar
21972197
mempool.AddTransactionsUpdated(1);
21982198

21992199
{
2200-
WaitableLock lock(csBestBlock);
2201-
hashBestBlock = pindexNew->GetBlockHash();
2202-
cvBlockChange.notify_all();
2200+
WaitableLock lock(g_best_block_mutex);
2201+
g_best_block = pindexNew->GetBlockHash();
2202+
g_best_block_cv.notify_all();
22032203
}
22042204

22052205
std::vector<std::string> warningMessages;

src/validation.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ extern BlockMap& mapBlockIndex;
164164
extern uint64_t nLastBlockTx;
165165
extern uint64_t nLastBlockWeight;
166166
extern const std::string strMessageMagic;
167-
extern CWaitableCriticalSection csBestBlock;
168-
extern CConditionVariable cvBlockChange;
169-
extern uint256 hashBestBlock;
167+
extern CWaitableCriticalSection g_best_block_mutex;
168+
extern CConditionVariable g_best_block_cv;
169+
extern uint256 g_best_block;
170170
extern std::atomic_bool fImporting;
171171
extern std::atomic_bool fReindex;
172172
extern int nScriptCheckThreads;

0 commit comments

Comments
 (0)