aboutsummaryrefslogtreecommitdiff
path: root/src/validation.h
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@gmail.com>2019-04-10 14:34:46 -0400
committerJames O'Beirne <james.obeirne@gmail.com>2019-07-08 11:33:13 -0400
commit682a1d0f2004d808b87b3106d0dfae547005e638 (patch)
tree33d9bcfcc7dd0614af9a379420a5a698b29cf7be /src/validation.h
parent55d525ab9004631d30dcc60a1ec5d9cd6c6afe56 (diff)
refactoring: remove mapBlockIndex global
in lieu of ::BlockIndex().
Diffstat (limited to 'src/validation.h')
-rw-r--r--src/validation.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/validation.h b/src/validation.h
index 4e971901b8..a1b8029e01 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -144,7 +144,6 @@ extern CCriticalSection cs_main;
extern CBlockPolicyEstimator feeEstimator;
extern CTxMemPool mempool;
typedef std::unordered_map<uint256, CBlockIndex*, BlockHasher> BlockMap;
-extern BlockMap& mapBlockIndex GUARDED_BY(cs_main);
extern Mutex g_best_block_mutex;
extern std::condition_variable g_best_block_cv;
extern uint256 g_best_block;
@@ -406,12 +405,7 @@ public:
/** Replay blocks that aren't fully applied to the database. */
bool ReplayBlocks(const CChainParams& params, CCoinsView* view);
-inline CBlockIndex* LookupBlockIndex(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
-{
- AssertLockHeld(cs_main);
- BlockMap::const_iterator it = mapBlockIndex.find(hash);
- return it == mapBlockIndex.end() ? nullptr : it->second;
-}
+CBlockIndex* LookupBlockIndex(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
/** Find the last common block between the parameter chain and a locator. */
CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
@@ -498,7 +492,7 @@ public:
/**
* If a block header hasn't already been seen, call CheckBlockHeader on it, ensure
- * that it doesn't descend from an invalid block, and then add it to mapBlockIndex.
+ * that it doesn't descend from an invalid block, and then add it to m_block_index.
*/
bool AcceptBlockHeader(
const CBlockHeader& block,
@@ -658,6 +652,9 @@ CChainState& ChainstateActive();
/** @returns the most-work chain. */
CChain& ChainActive();
+/** @returns the global block index map. */
+BlockMap& BlockIndex();
+
/** Global variable that points to the coins database (protected by cs_main) */
extern std::unique_ptr<CCoinsViewDB> pcoinsdbview;