32 static const int64_t
nMaxDbCache =
sizeof(
void*) > 4 ? 16384 : 1024;
53 std::unique_ptr<CDBWrapper>
m_db;
67 std::unique_ptr<CCoinsViewCursor>
Cursor()
const override;
81 explicit CBlockTreeDB(
size_t nCacheSize,
bool fMemory =
false,
bool fWipe =
false);
83 bool WriteBatchSync(
const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo,
int nLastFile,
const std::vector<const CBlockIndex*>& blockinfo);
96 #endif // BITCOIN_TXDB_H bool GetCoin(const COutPoint &outpoint, Coin &coin) const override
Retrieve the Coin (unspent transaction output) for a given outpoint.
std::unique_ptr< CCoinsViewCursor > Cursor() const override
Get a cursor to iterate over the whole state.
static const int64_t nMaxTxIndexCache
Max memory allocated to block tree DB specific cache, if -txindex (MiB)
bool ReadLastBlockFile(int &nFile)
CCoinsViewDB(fs::path ldb_path, size_t nCacheSize, bool fMemory, bool fWipe)
void ReadReindexing(bool &fReindexing)
void ResizeCache(size_t new_cache_size) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Dynamically alter the underlying leveldb cache size.
static const int64_t nMinDbCache
min. -dbcache (MiB)
static const int64_t max_filter_index_cache
Max memory allocated to all block filter index caches combined in MiB.
bool WriteReindexing(bool fReindexing)
bool NeedsUpgrade()
Whether an unsupported database format is used.
Transaction validation functions.
Access to the block database (blocks/index/)
Abstract view on the open txout dataset.
std::unordered_map< COutPoint, CCoinsCacheEntry, SaltedOutpointHasher > CCoinsMap
static const int64_t nDefaultDbCache
-dbcache default (MiB)
static const int64_t nDefaultDbBatchSize
-dbbatchsize default (bytes)
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.
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)
static const int64_t nMaxBlockDBCache
Max memory allocated to block tree DB specific cache, if no -txindex (MiB)
uint256 GetBestBlock() const override
Retrieve the block hash whose state this CCoinsView currently represents.
std::optional< bilingual_str > CheckLegacyTxindex(CBlockTreeDB &block_tree_db)
#define EXCLUSIVE_LOCKS_REQUIRED(...)
The block chain is a tree shaped structure starting with the genesis block at the root...
const CChainParams & Params()
Return the currently selected parameters.
CCoinsView backed by the coin database (chainstate/)
static const int64_t nMaxCoinsDBCache
Max memory allocated to coin DB specific cache (MiB)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate...
static const int64_t nMaxDbCache
max. -dbcache (MiB)
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).
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
std::vector< uint256 > GetHeadBlocks() const override
Retrieve the range of blocks that may have been only partially written.
std::unique_ptr< CDBWrapper > m_db