18 #include <boost/function.hpp>
25 static constexpr
int DB_PEAK_USAGE_FACTOR = 2;
27 static constexpr
int MAX_BLOCK_COINSDB_USAGE = 200 * DB_PEAK_USAGE_FACTOR;
29 static constexpr
int MIN_BLOCK_COINSDB_USAGE = 50 * DB_PEAK_USAGE_FACTOR;
31 static const int64_t nDefaultDbCache = 450;
33 static const int64_t nMaxDbCache =
sizeof(
void*) > 4 ? 16384 : 1024;
35 static const int64_t nMinDbCache = 4;
37 static const int64_t nMaxBlockDBCache = 2;
41 static const int64_t nMaxBlockDBAndTxIndexCache = 1024;
43 static const int64_t nMaxCoinsDBCache = 8;
51 template <
typename Stream,
typename Operation>
76 CCoinsViewDB(
size_t nCacheSize,
bool fMemory =
false,
bool fWipe =
false);
111 CBlockTreeDB(
size_t nCacheSize,
bool fMemory =
false,
bool fWipe =
false);
116 bool WriteBatchSync(
const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo,
int nLastFile,
const std::vector<const CBlockIndex*>& blockinfo);
122 bool WriteTxIndex(
const std::vector<std::pair<uint256, CDiskTxPos> > &list);
123 bool WriteFlag(
const std::string &name,
bool fValue);
124 bool ReadFlag(
const std::string &name,
bool &fValue);
The block chain is a tree shaped structure starting with the genesis block at the root,...
Access to the block database (blocks/index/)
bool ReadReindexing(bool &fReindex)
bool WriteTxIndex(const std::vector< std::pair< uint256, CDiskTxPos > > &list)
CBlockTreeDB(size_t nCacheSize, bool fMemory=false, bool fWipe=false)
bool ReadBlockFileInfo(int nFile, CBlockFileInfo &fileinfo)
bool ReadTxIndex(const uint256 &txid, CDiskTxPos &pos)
CBlockTreeDB(const CBlockTreeDB &)
bool LoadBlockIndexGuts(boost::function< CBlockIndex *(const uint256 &)> insertBlockIndex)
bool WriteReindexing(bool fReindex)
void operator=(const CBlockTreeDB &)
bool WriteBatchSync(const std::vector< std::pair< int, const CBlockFileInfo * > > &fileInfo, int nLastFile, const std::vector< const CBlockIndex * > &blockinfo)
bool ReadFlag(const std::string &name, bool &fValue)
bool ReadLastBlockFile(int &nFile)
bool WriteFlag(const std::string &name, bool fValue)
Pruned version of CTransaction: only retains metadata and unspent transaction outputs.
Cursor for iterating over CoinsView state.
Specialization of CCoinsViewCursor to iterate over a CCoinsViewDB.
std::unique_ptr< CDBIterator > pcursor
bool GetValue(CCoins &coins) const
bool GetKey(uint256 &key) const
CCoinsViewDBCursor(CDBIterator *pcursorIn, const uint256 &hashBlockIn)
unsigned int GetValueSize() const
std::pair< char, uint256 > keyTmp
CCoinsView backed by the coin database (chainstate/)
CCoinsViewDB(size_t nCacheSize, bool fMemory=false, bool fWipe=false)
CCoinsViewCursor * Cursor() const
Get a cursor to iterate over the whole state.
bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock)
Do a bulk modification (multiple CCoins changes + BestBlock change).
bool GetCoins(const uint256 &txid, CCoins &coins) const
Retrieve the CCoins (unspent transaction outputs) for a given txid.
uint256 GetBestBlock() const
Retrieve the block hash whose state this CCoinsView currently represents.
bool HaveCoins(const uint256 &txid) const
Just check whether we have data for a given txid.
Abstract view on the open txout dataset.
boost::unordered_map< uint256, CCoinsCacheEntry, SaltedTxidHasher > CCoinsMap
void SerializationOp(Stream &s, Operation ser_action)
CDiskTxPos(const CDiskBlockPos &blockIn, unsigned int nTxOffsetIn)