diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-10-23 00:21:16 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2012-10-23 00:27:17 +0200 |
commit | c2ed184f987fbb157880fce2f91ebc8514fd6e76 (patch) | |
tree | 446f1d6b1dbe7ab527da1598a3b258028894b06a /src/main.h | |
parent | 1e64c2d585eeb6217d08a49c4cc7a89e0afd0421 (diff) | |
download | bitcoin-c2ed184f987fbb157880fce2f91ebc8514fd6e76.tar.xz |
Added some comments
Some clarifications after a code review by Mike Hearn.
Diffstat (limited to 'src/main.h')
-rw-r--r-- | src/main.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main.h b/src/main.h index 75950109da..36869efe63 100644 --- a/src/main.h +++ b/src/main.h @@ -1820,7 +1820,11 @@ public: // Modify the currently active block index virtual bool SetBestBlock(CBlockIndex *pindex); + + // Do a bulk modification (multiple SetCoins + one SetBestBlock) virtual bool BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockIndex *pindex); + + // Calculate statistics about the unspent transaction output set virtual bool GetStats(CCoinsStats &stats); }; @@ -1851,14 +1855,25 @@ protected: public: CCoinsViewCache(CCoinsView &baseIn, bool fDummy = false); + + // Standard CCoinsView methods bool GetCoins(uint256 txid, CCoins &coins); bool SetCoins(uint256 txid, const CCoins &coins); bool HaveCoins(uint256 txid); - CCoins &GetCoins(uint256 txid); CBlockIndex *GetBestBlock(); bool SetBestBlock(CBlockIndex *pindex); bool BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockIndex *pindex); + + // Return a modifiable reference to a CCoins. Check HaveCoins first. + // Many methods explicitly require a CCoinsViewCache because of this method, to reduce + // copying. + CCoins &GetCoins(uint256 txid); + + // Push the modifications applied to this cache to its base. + // Failure to call this method before destruction will cause the changes to be forgotten. bool Flush(); + + // Calculate the size of the cache (in number of transactions) unsigned int GetCacheSize(); private: |