diff options
author | Pieter Wuille <sipa@ulyssis.org> | 2013-11-05 02:27:39 +0100 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2013-11-10 19:22:53 +0100 |
commit | 84674082b0c4cfcdd54fb97a29bc841aa7f691c2 (patch) | |
tree | 87fb3462d81b84c0d4a64cb5eca7ab8c64895091 /src/main.h | |
parent | f76c122e2eac8ef66f69d142231bd33c88a24c50 (diff) |
Make CCoinsView use block hashes instead of indices
Diffstat (limited to 'src/main.h')
-rw-r--r-- | src/main.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main.h b/src/main.h index d717802618..b8db357aed 100644 --- a/src/main.h +++ b/src/main.h @@ -1062,14 +1062,14 @@ public: // This may (but cannot always) return true for fully spent transactions virtual bool HaveCoins(const uint256 &txid); - // Retrieve the block index whose state this CCoinsView currently represents - virtual CBlockIndex *GetBestBlock(); + // Retrieve the block hash whose state this CCoinsView currently represents + virtual uint256 GetBestBlock(); - // Modify the currently active block index - virtual bool SetBestBlock(CBlockIndex *pindex); + // Modify the currently active block hash + virtual bool SetBestBlock(const uint256 &hashBlock); // Do a bulk modification (multiple SetCoins + one SetBestBlock) - virtual bool BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockIndex *pindex); + virtual bool BatchWrite(const std::map<uint256, CCoins> &mapCoins, const uint256 &hashBlock); // Calculate statistics about the unspent transaction output set virtual bool GetStats(CCoinsStats &stats); @@ -1089,10 +1089,10 @@ public: bool GetCoins(const uint256 &txid, CCoins &coins); bool SetCoins(const uint256 &txid, const CCoins &coins); bool HaveCoins(const uint256 &txid); - CBlockIndex *GetBestBlock(); - bool SetBestBlock(CBlockIndex *pindex); + uint256 GetBestBlock(); + bool SetBestBlock(const uint256 &hashBlock); void SetBackend(CCoinsView &viewIn); - bool BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockIndex *pindex); + bool BatchWrite(const std::map<uint256, CCoins> &mapCoins, const uint256 &hashBlock); bool GetStats(CCoinsStats &stats); }; @@ -1100,7 +1100,7 @@ public: class CCoinsViewCache : public CCoinsViewBacked { protected: - CBlockIndex *pindexTip; + uint256 hashBlock; std::map<uint256,CCoins> cacheCoins; public: @@ -1110,9 +1110,9 @@ public: bool GetCoins(const uint256 &txid, CCoins &coins); bool SetCoins(const uint256 &txid, const CCoins &coins); bool HaveCoins(const uint256 &txid); - CBlockIndex *GetBestBlock(); - bool SetBestBlock(CBlockIndex *pindex); - bool BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockIndex *pindex); + uint256 GetBestBlock(); + bool SetBestBlock(const uint256 &hashBlock); + bool BatchWrite(const std::map<uint256, CCoins> &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 |