aboutsummaryrefslogtreecommitdiff
path: root/src/index
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@gmail.com>2019-03-27 11:14:25 -0400
committerJames O'Beirne <james.obeirne@gmail.com>2019-05-03 15:02:54 -0400
commit631940aab228ccca64c15e05d5953f40381a0ffc (patch)
tree694cfe15bf0a6d9271fc9b6c10fda5a77c935580 /src/index
parenta3a609079c76dd2bbc72127488bf466cc61d8940 (diff)
downloadbitcoin-631940aab228ccca64c15e05d5953f40381a0ffc.tar.xz
scripted-diff: replace chainActive -> ::ChainActive()
Though at the moment ChainActive() simply references `g_chainstate.m_chain`, doing this change now clears the way for multiple chainstate usage and allows us to script the diff. -BEGIN VERIFY SCRIPT- git grep -l "chainActive" | grep -E '(h|cpp)$' | xargs sed -i '/chainActive =/b; /extern CChain& chainActive/b; s/\(::\)\{0,1\}chainActive/::ChainActive()/g' -END VERIFY SCRIPT-
Diffstat (limited to 'src/index')
-rw-r--r--src/index/base.cpp16
-rw-r--r--src/index/txindex.cpp2
2 files changed, 9 insertions, 9 deletions
diff --git a/src/index/base.cpp b/src/index/base.cpp
index 9e48f0bd27..bcc8e2ce7c 100644
--- a/src/index/base.cpp
+++ b/src/index/base.cpp
@@ -63,9 +63,9 @@ bool BaseIndex::Init()
if (locator.IsNull()) {
m_best_block_index = nullptr;
} else {
- m_best_block_index = FindForkInGlobalIndex(chainActive, locator);
+ m_best_block_index = FindForkInGlobalIndex(::ChainActive(), locator);
}
- m_synced = m_best_block_index.load() == chainActive.Tip();
+ m_synced = m_best_block_index.load() == ::ChainActive().Tip();
return true;
}
@@ -74,15 +74,15 @@ static const CBlockIndex* NextSyncBlock(const CBlockIndex* pindex_prev) EXCLUSIV
AssertLockHeld(cs_main);
if (!pindex_prev) {
- return chainActive.Genesis();
+ return ::ChainActive().Genesis();
}
- const CBlockIndex* pindex = chainActive.Next(pindex_prev);
+ const CBlockIndex* pindex = ::ChainActive().Next(pindex_prev);
if (pindex) {
return pindex;
}
- return chainActive.Next(chainActive.FindFork(pindex_prev));
+ return ::ChainActive().Next(::ChainActive().FindFork(pindex_prev));
}
void BaseIndex::ThreadSync()
@@ -168,7 +168,7 @@ bool BaseIndex::Commit()
bool BaseIndex::CommitInternal(CDBBatch& batch)
{
LOCK(cs_main);
- GetDB().WriteBestBlock(batch, chainActive.GetLocator(m_best_block_index));
+ GetDB().WriteBestBlock(batch, ::ChainActive().GetLocator(m_best_block_index));
return true;
}
@@ -280,9 +280,9 @@ bool BaseIndex::BlockUntilSyncedToCurrentChain()
{
// Skip the queue-draining stuff if we know we're caught up with
- // chainActive.Tip().
+ // ::ChainActive().Tip().
LOCK(cs_main);
- const CBlockIndex* chain_tip = chainActive.Tip();
+ const CBlockIndex* chain_tip = ::ChainActive().Tip();
const CBlockIndex* best_block_index = m_best_block_index.load();
if (best_block_index->GetAncestor(chain_tip->nHeight) == chain_tip) {
return true;
diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp
index 7367ec7cb6..929b85bfb5 100644
--- a/src/index/txindex.cpp
+++ b/src/index/txindex.cpp
@@ -236,7 +236,7 @@ bool TxIndex::Init()
// Attempt to migrate txindex from the old database to the new one. Even if
// chain_tip is null, the node could be reindexing and we still want to
// delete txindex records in the old database.
- if (!m_db->MigrateData(*pblocktree, chainActive.GetLocator())) {
+ if (!m_db->MigrateData(*pblocktree, ::ChainActive().GetLocator())) {
return false;
}