mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Make CCoinsView use block hashes instead of indices
This commit is contained in:
committed by
Pieter Wuille
parent
f76c122e2e
commit
84674082b0
24
src/main.h
24
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
|
||||
|
||||
Reference in New Issue
Block a user