25 static constexpr
int MAX_BLOCK_COINSDB_USAGE = 10;
27 static const int64_t nDefaultDbCache = 450;
29 static const int64_t nDefaultDbBatchSize = 16 << 20;
31 static const int64_t nMaxDbCache =
sizeof(
void*) > 4 ? 16384 : 1024;
33 static const int64_t nMinDbCache = 4;
35 static const int64_t nMaxBlockDBCache = 2;
39 static const int64_t nMaxTxIndexCache = 1024;
41 static const int64_t nMaxCoinsDBCache = 8;
49 explicit CCoinsViewDB(
size_t nCacheSize,
bool fMemory =
false,
bool fWipe =
false);
73 bool Valid()
const override;
89 explicit CBlockTreeDB(
size_t nCacheSize,
bool fMemory =
false,
bool fWipe =
false);
91 bool WriteBatchSync(
const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo,
int nLastFile,
const std::vector<const CBlockIndex*>& blockinfo);
101 #endif // BITCOIN_TXDB_H bool GetValue(Coin &coin) const override
bool GetCoin(const COutPoint &outpoint, Coin &coin) const override
Retrieve the Coin (unspent transaction output) for a given outpoint.
bool Upgrade()
Attempt to update from an older database format. Returns whether an error occurred.
Specialization of CCoinsViewCursor to iterate over a CCoinsViewDB.
bool ReadLastBlockFile(int &nFile)
std::unique_ptr< CDBIterator > pcursor
void ReadReindexing(bool &fReindexing)
bool GetKey(COutPoint &key) const override
bool WriteReindexing(bool fReindexing)
Access to the block database (blocks/index/)
Abstract view on the open txout dataset.
std::unordered_map< COutPoint, CCoinsCacheEntry, SaltedOutpointHasher > CCoinsMap
CCoinsViewDBCursor(CDBIterator *pcursorIn, const uint256 &hashBlockIn)
size_t EstimateSize() const override
Estimate database size (0 if not implemented)
Parameters that influence chain consensus.
An outpoint - a combination of a transaction hash and an index n into its vout.
std::pair< char, COutPoint > keyTmp
bool HaveCoin(const COutPoint &outpoint) const override
Just check whether a given outpoint is unspent.
bool ReadFlag(const std::string &name, bool &fValue)
CBlockTreeDB(size_t nCacheSize, bool fMemory=false, bool fWipe=false)
bool WriteBatchSync(const std::vector< std::pair< int, const CBlockFileInfo *> > &fileInfo, int nLastFile, const std::vector< const CBlockIndex *> &blockinfo)
bool ReadBlockFileInfo(int nFile, CBlockFileInfo &info)
CCoinsViewDB(size_t nCacheSize, bool fMemory=false, bool fWipe=false)
uint256 GetBestBlock() const override
Retrieve the block hash whose state this CCoinsView currently represents.
The block chain is a tree shaped structure starting with the genesis block at the root...
CCoinsView backed by the coin database (chainstate/)
bool LoadBlockIndexGuts(const Consensus::Params &consensusParams, std::function< CBlockIndex *(const uint256 &)> insertBlockIndex)
bool WriteFlag(const std::string &name, bool fValue)
bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) override
Do a bulk modification (multiple Coin changes + BestBlock change).
CCoinsViewCursor * Cursor() const override
Get a cursor to iterate over the whole state.
bool Valid() const override
unsigned int GetValueSize() const override
std::vector< uint256 > GetHeadBlocks() const override
Retrieve the range of blocks that may have been only partially written.
Cursor for iterating over CoinsView state.