refactor: pcoinsTip -> CChainState::CoinsTip()

This aliasing makes subsequent commits easier to review; eventually CoinsTip()
will return the CCoinsViewCache managed by CChainState.
This commit is contained in:
James O'Beirne
2019-07-24 11:45:04 -04:00
parent e5fdda68c6
commit fae6ab6aed
13 changed files with 70 additions and 58 deletions

View File

@@ -505,6 +505,9 @@ public:
CBlockIndex** ppindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
};
/** Global variable that points to the active CCoinsView (protected by cs_main) */
extern std::unique_ptr<CCoinsViewCache> pcoinsTip;
/**
* CChainState stores and provides an API to update our local knowledge of the
* current best chain.
@@ -566,6 +569,12 @@ public:
*/
std::set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexCandidates;
//! @returns A reference to the in-memory cache of the UTXO set.
CCoinsViewCache& CoinsTip()
{
return *::pcoinsTip;
}
/**
* Update the on-disk chain state.
* The caches and indexes are flushed depending on the mode we're called with
@@ -662,9 +671,6 @@ BlockMap& BlockIndex();
/** Global variable that points to the coins database (protected by cs_main) */
extern std::unique_ptr<CCoinsViewDB> pcoinsdbview;
/** Global variable that points to the active CCoinsView (protected by cs_main) */
extern std::unique_ptr<CCoinsViewCache> pcoinsTip;
/** Global variable that points to the active block tree (protected by cs_main) */
extern std::unique_ptr<CBlockTreeDB> pblocktree;