diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-06-25 13:45:29 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-07-01 12:48:16 +0200 |
commit | dd638dd712861a2fc419fe9b2b064ae303b074e6 (patch) | |
tree | 399148512c76f75fd7f84ee25cd06c9ac61ac843 /src/coins.h | |
parent | 8d9cc7d743583f6cb72d224af458fa5f470b00e8 (diff) |
typedef std::map<uint256, CCoins> to CCoinsMap
This makes it possible to switch to a more efficient map type
without changing all occurences manually.
Merges half of #4413.
Diffstat (limited to 'src/coins.h')
-rw-r--r-- | src/coins.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/coins.h b/src/coins.h index 0ad28524a1..c57a5ec722 100644 --- a/src/coins.h +++ b/src/coins.h @@ -239,6 +239,7 @@ public: } }; +typedef std::map<uint256,CCoins> CCoinsMap; struct CCoinsStats { @@ -275,7 +276,7 @@ public: virtual bool SetBestBlock(const uint256 &hashBlock); // Do a bulk modification (multiple SetCoins + one SetBestBlock) - virtual bool BatchWrite(const std::map<uint256, CCoins> &mapCoins, const uint256 &hashBlock); + virtual bool BatchWrite(const CCoinsMap &mapCoins, const uint256 &hashBlock); // Calculate statistics about the unspent transaction output set virtual bool GetStats(CCoinsStats &stats); @@ -299,7 +300,7 @@ public: uint256 GetBestBlock(); bool SetBestBlock(const uint256 &hashBlock); void SetBackend(CCoinsView &viewIn); - bool BatchWrite(const std::map<uint256, CCoins> &mapCoins, const uint256 &hashBlock); + bool BatchWrite(const CCoinsMap &mapCoins, const uint256 &hashBlock); bool GetStats(CCoinsStats &stats); }; @@ -309,7 +310,7 @@ class CCoinsViewCache : public CCoinsViewBacked { protected: uint256 hashBlock; - std::map<uint256,CCoins> cacheCoins; + CCoinsMap cacheCoins; public: CCoinsViewCache(CCoinsView &baseIn, bool fDummy = false); @@ -320,7 +321,7 @@ public: bool HaveCoins(const uint256 &txid); uint256 GetBestBlock(); bool SetBestBlock(const uint256 &hashBlock); - bool BatchWrite(const std::map<uint256, CCoins> &mapCoins, const uint256 &hashBlock); + bool BatchWrite(const CCoinsMap &mapCoins, const uint256 &hashBlock); // Return a modifiable reference to a CCoins. Check HaveCoins first. // Many methods explicitly require a CCoinsViewCache because of this method, to reduce @@ -352,7 +353,7 @@ public: const CTxOut &GetOutputFor(const CTxIn& input); private: - std::map<uint256,CCoins>::iterator FetchCoins(const uint256 &txid); + CCoinsMap::iterator FetchCoins(const uint256 &txid); }; #endif |