Bitcoin Core 31.99.0
P2P Digital Currency
blockstorage.h
Go to the documentation of this file.
1// Copyright (c) 2011-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_NODE_BLOCKSTORAGE_H
6#define BITCOIN_NODE_BLOCKSTORAGE_H
7
8#include <attributes.h>
9#include <chain.h>
10#include <dbwrapper.h>
11#include <flatfile.h>
13#include <kernel/chainparams.h>
14#include <kernel/cs_main.h>
16#include <primitives/block.h>
17#include <serialize.h>
18#include <streams.h>
19#include <sync.h>
20#include <uint256.h>
21// IWYU incorrectly suggests removing this header.
22// See https://github.com/include-what-you-use/include-what-you-use/issues/2014.
23#include <util/byte_units.h> // IWYU pragma: keep
24#include <util/expected.h>
25#include <util/fs.h>
26#include <util/hasher.h>
27#include <util/obfuscation.h>
28
29#include <algorithm>
30#include <array>
31#include <atomic>
32#include <cstddef>
33#include <cstdint>
34#include <functional>
35#include <iosfwd>
36#include <limits>
37#include <map>
38#include <memory>
39#include <optional>
40#include <set>
41#include <span>
42#include <string>
43#include <unordered_map>
44#include <utility>
45#include <vector>
46
48class CBlockUndo;
49class Chainstate;
51namespace Consensus {
52struct Params;
53}
54namespace util {
55class SignalInterrupt;
56} // namespace util
57
58namespace kernel {
60{
61public:
62 uint32_t nBlocks{};
63 uint32_t nSize{};
64 uint32_t nUndoSize{};
65 uint32_t nHeightFirst{};
66 uint32_t nHeightLast{};
67 uint64_t nTimeFirst{};
68 uint64_t nTimeLast{};
69
71 {
72 READWRITE(VARINT(obj.nBlocks));
73 READWRITE(VARINT(obj.nSize));
74 READWRITE(VARINT(obj.nUndoSize));
75 READWRITE(VARINT(obj.nHeightFirst));
76 READWRITE(VARINT(obj.nHeightLast));
77 READWRITE(VARINT(obj.nTimeFirst));
78 READWRITE(VARINT(obj.nTimeLast));
79 }
80
81 CBlockFileInfo() = default;
82
83 std::string ToString() const;
84
86 void AddBlock(unsigned int nHeightIn, uint64_t nTimeIn)
87 {
88 if (nBlocks == 0 || nHeightFirst > nHeightIn)
89 nHeightFirst = nHeightIn;
90 if (nBlocks == 0 || nTimeFirst > nTimeIn)
91 nTimeFirst = nTimeIn;
92 nBlocks++;
93 if (nHeightIn > nHeightLast)
94 nHeightLast = nHeightIn;
95 if (nTimeIn > nTimeLast)
96 nTimeLast = nTimeIn;
97 }
98};
99
102{
103public:
105 void WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*>>& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo);
106 bool ReadBlockFileInfo(int nFile, CBlockFileInfo& info);
107 bool ReadLastBlockFile(int& nFile);
108 void WriteReindexing(bool fReindexing);
109 void ReadReindexing(bool& fReindexing);
110 void WriteFlag(const std::string& name, bool fValue);
111 bool ReadFlag(const std::string& name, bool& fValue);
112 bool LoadBlockIndexGuts(const Consensus::Params& consensusParams, std::function<CBlockIndex*(const uint256&)> insertBlockIndex, const util::SignalInterrupt& interrupt)
114};
115} // namespace kernel
116
117namespace node {
120
122static const unsigned int BLOCKFILE_CHUNK_SIZE{16_MiB};
124static const unsigned int UNDOFILE_CHUNK_SIZE{1_MiB};
126static const unsigned int MAX_BLOCKFILE_SIZE{128_MiB};
127
129static constexpr uint32_t STORAGE_HEADER_BYTES{std::tuple_size_v<MessageStartChars> + sizeof(unsigned int)};
130
133
134// Because validation code takes pointers to the map's CBlockIndex objects, if
135// we ever switch to another associative container, we need to either use a
136// container that has stable addressing (true of all std associative
137// containers), or make the key a `std::unique_ptr<CBlockIndex>`
138using BlockMap = std::unordered_map<uint256, CBlockIndex, BlockHasher>;
139
141 bool operator()(const CBlockIndex* pa, const CBlockIndex* pb) const;
142 using is_transparent = void;
143};
144
146 /* Only compares the height of two block indices, doesn't try to tie-break */
147 bool operator()(const CBlockIndex* pa, const CBlockIndex* pb) const;
148};
149
152 int height_first{std::numeric_limits<int>::max()};
153};
154
156 // Values used as array indexes - do not change carelessly.
160};
161
162std::ostream& operator<<(std::ostream& os, const BlockfileType& type);
163
165 // The latest blockfile number.
166 int file_num{0};
167
168 // Track the height of the highest block in file_num whose undo
169 // data has been written. Block data is written to block files in download
170 // order, but is written to undo files in validation order, which is
171 // usually in order by height. To avoid wasting disk space, undo files will
172 // be trimmed whenever the corresponding block file is finalized and
173 // the height of the highest block written to the block file equals the
174 // height of the highest block written to the undo file. This is a
175 // heuristic and can sometimes preemptively trim undo files that will write
176 // more data later, and sometimes fail to trim undo files that can't have
177 // more data written later.
179};
180
181std::ostream& operator<<(std::ostream& os, const BlockfileCursor& cursor);
182
183enum class ReadRawError {
184 IO,
186};
187
196{
199
200private:
201 const CChainParams& GetParams() const { return m_opts.chainparams; }
208 bool LoadBlockIndex(const std::optional<uint256>& snapshot_blockhash)
210
212 [[nodiscard]] bool FlushBlockFile(int blockfile_num, bool fFinalize, bool finalize_undo) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
213
215 [[nodiscard]] bool FlushUndoFile(int block_file, bool finalize = false);
216
226 [[nodiscard]] FlatFilePos FindNextBlockPos(unsigned int nAddSize, unsigned int nHeight, uint64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
227 [[nodiscard]] bool FlushChainstateBlockFile(int tip_height) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
228 [[nodiscard]] bool FindUndoPos(BlockValidationState& state, int nFile, FlatFilePos& pos, unsigned int nAddSize) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
229
230 AutoFile OpenUndoFile(const FlatFilePos& pos, bool fReadOnly = false) const;
231
232 /* Calculate the block/rev files to delete based on height specified by user with RPC command pruneblockchain */
234 std::set<int>& setFilesToPrune,
235 int nManualPruneHeight,
236 const Chainstate& chain);
237
254 void FindFilesToPrune(
255 std::set<int>& setFilesToPrune,
256 int last_prune,
257 const Chainstate& chain,
258 ChainstateManager& chainman);
259
270 std::array<std::optional<BlockfileCursor>, BlockfileType::NUM_TYPES>
271 m_blockfile_cursors GUARDED_BY(::cs_main) = {
273 std::nullopt,
274 };
276 {
278 static const BlockfileCursor empty_cursor;
279 const auto& normal = m_blockfile_cursors[BlockfileType::NORMAL].value_or(empty_cursor);
280 const auto& assumed = m_blockfile_cursors[BlockfileType::ASSUMED].value_or(empty_cursor);
281 return std::max(normal.file_num, assumed.file_num);
282 }
283
289
290 const bool m_prune_mode;
291
293
300 std::unordered_map<std::string, PruneLockInfo> m_prune_locks GUARDED_BY(::cs_main);
301
303
305
308
309protected:
310 std::vector<CBlockFileInfo> m_blockfile_info;
311
313 std::set<CBlockIndex*> m_dirty_blockindex;
314
316 std::set<int> m_dirty_fileinfo;
317
318public:
321
322 explicit BlockManager(const util::SignalInterrupt& interrupt, Options opts);
323
325 std::atomic<bool> m_importing{false};
326
333 std::atomic_bool m_blockfiles_indexed{true};
334
336
349 std::optional<int> m_snapshot_height;
350
351 std::vector<CBlockIndex*> GetAllBlockIndices() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
352
358
359 std::unique_ptr<BlockTreeDB> m_block_tree_db GUARDED_BY(::cs_main);
360
361 void WriteBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
362 bool LoadBlockIndexDB(const std::optional<uint256>& snapshot_blockhash)
364
370 void ScanAndUnlinkAlreadyPrunedFiles() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
371
375
378
381
383 CBlockFileInfo* GetBlockFileInfo(size_t n) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
384
385 bool WriteBlockUndo(const CBlockUndo& blockundo, BlockValidationState& state, CBlockIndex& block)
387
396 FlatFilePos WriteBlock(const CBlock& block, int nHeight) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
397
404 void UpdateBlockInfo(const CBlock& block, unsigned int nHeight, const FlatFilePos& pos) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
405
407 [[nodiscard]] bool IsPruneMode() const { return m_prune_mode; }
408
410 [[nodiscard]] uint64_t GetPruneTarget() const { return m_opts.prune_target; }
411 static constexpr auto PRUNE_TARGET_MANUAL{std::numeric_limits<uint64_t>::max()};
412
413 [[nodiscard]] bool LoadingBlocks() const { return m_importing || !m_blockfiles_indexed; }
414
416 uint64_t CalculateCurrentUsage() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
417
422 bool CheckBlockDataAvailability(const CBlockIndex& upper_block, const CBlockIndex& lower_block, BlockStatus block_status = BLOCK_HAVE_DATA) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
423
446 const CBlockIndex& GetFirstBlock(
447 const CBlockIndex& upper_block LIFETIMEBOUND,
448 uint32_t status_mask,
449 const CBlockIndex* lower_block LIFETIMEBOUND = nullptr
451
453 bool m_have_pruned = false;
454
456 bool IsBlockPruned(const CBlockIndex& block) const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
457
459 void UpdatePruneLock(const std::string& name, const PruneLockInfo& lock_info) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
460
462 bool DeletePruneLock(const std::string& name) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
463
465 AutoFile OpenBlockFile(const FlatFilePos& pos, bool fReadOnly) const;
466
468 fs::path GetBlockPosFilename(const FlatFilePos& pos) const;
469
473 void UnlinkPrunedFiles(const std::set<int>& setFilesToPrune) const;
474
476 bool ReadBlock(CBlock& block, const FlatFilePos& pos, const std::optional<uint256>& expected_hash) const;
477 bool ReadBlock(CBlock& block, const CBlockIndex& index) const;
478 ReadRawBlockResult ReadRawBlock(const FlatFilePos& pos, std::optional<std::pair<size_t, size_t>> block_part = std::nullopt) const;
479
480 bool ReadBlockUndo(CBlockUndo& blockundo, const CBlockIndex& index) const;
481
482 void CleanupBlockRevFiles() const;
483};
484
485// Calls ActivateBestChain() even if no blocks are imported.
486void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_paths);
487} // namespace node
488
489#endif // BITCOIN_NODE_BLOCKSTORAGE_H
#define LIFETIMEBOUND
Definition: attributes.h:16
void CheckBlockDataAvailability(BlockManager &blockman, const CBlockIndex &blockindex, bool check_for_undo)
Definition: blockchain.cpp:680
BlockStatus
Definition: chain.h:42
@ BLOCK_HAVE_DATA
full block available in blk*.dat
Definition: chain.h:75
const CChainParams & Params()
Return the currently selected parameters.
Non-refcounted RAII wrapper for FILE*.
Definition: streams.h:395
Nodes collect new transactions into a block, hash them into a hash tree, and scan through nonce value...
Definition: block.h:27
Definition: block.h:74
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: chain.h:94
Undo information for a CBlock.
Definition: undo.h:64
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Definition: chainparams.h:77
const Consensus::Params & GetConsensus() const
Definition: chainparams.h:89
CDBWrapper(const DBParams &params)
Definition: dbwrapper.cpp:220
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Definition: validation.h:551
Interface for managing multiple Chainstate objects, where each chainstate is associated with chainsta...
Definition: validation.h:940
FlatFileSeq represents a sequence of numbered files storing raw data.
Definition: flatfile.h:42
static constexpr unsigned int size()
Definition: uint256.h:107
Access to the block database (blocks/index/)
Definition: blockstorage.h:102
void WriteBatchSync(const std::vector< std::pair< int, const CBlockFileInfo * > > &fileInfo, int nLastFile, const std::vector< const CBlockIndex * > &blockinfo)
bool ReadLastBlockFile(int &nFile)
void WriteReindexing(bool fReindexing)
bool ReadFlag(const std::string &name, bool &fValue)
bool ReadBlockFileInfo(int nFile, CBlockFileInfo &info)
void ReadReindexing(bool &fReindexing)
void WriteFlag(const std::string &name, bool fValue)
SERIALIZE_METHODS(CBlockFileInfo, obj)
Definition: blockstorage.h:70
uint32_t nSize
number of used bytes of block file
Definition: blockstorage.h:63
uint32_t nUndoSize
number of used bytes in the undo file
Definition: blockstorage.h:64
void AddBlock(unsigned int nHeightIn, uint64_t nTimeIn)
update statistics (does not update nSize)
Definition: blockstorage.h:86
std::string ToString() const
uint64_t nTimeFirst
earliest time of block in file
Definition: blockstorage.h:67
uint64_t nTimeLast
latest time of block in file
Definition: blockstorage.h:68
uint32_t nHeightFirst
lowest height of block in file
Definition: blockstorage.h:65
uint32_t nBlocks
number of blocks stored in file
Definition: blockstorage.h:62
uint32_t nHeightLast
highest height of block in file
Definition: blockstorage.h:66
Maintains a tree of blocks (stored in m_block_index) which is consulted to determine where the most-w...
Definition: blockstorage.h:196
const kernel::BlockManagerOpts m_opts
Definition: blockstorage.h:304
std::set< int > m_dirty_fileinfo
Dirty block file entries.
Definition: blockstorage.h:316
const FlatFileSeq m_undo_file_seq
Definition: blockstorage.h:307
const CChainParams & GetParams() const
Definition: blockstorage.h:201
void PruneOneBlockFile(int fileNumber) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Mark one block file as pruned (modify associated database entries)
void FindFilesToPrune(std::set< int > &setFilesToPrune, int last_prune, const Chainstate &chain, ChainstateManager &chainman)
Prune block and undo files (blk???.dat and rev???.dat) so that the disk space used is less than a use...
const Obfuscation m_obfuscation
Definition: blockstorage.h:292
static constexpr auto PRUNE_TARGET_MANUAL
Definition: blockstorage.h:411
CBlockIndex * LookupBlockIndex(const uint256 &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
bool ReadBlockUndo(CBlockUndo &blockundo, const CBlockIndex &index) const
int MaxBlockfileNum() const EXCLUSIVE_LOCKS_REQUIRED(
Definition: blockstorage.h:275
CBlockFileInfo *GetBlockFileInfo(size_t n) EXCLUSIVE_LOCKS_REQUIRED(bool WriteBlockUndo(const CBlockUndo &blockundo, BlockValidationState &state, CBlockIndex &block) EXCLUSIVE_LOCKS_REQUIRED(FlatFilePos WriteBlock(const CBlock &block, int nHeight) EXCLUSIVE_LOCKS_REQUIRED(void UpdateBlockInfo(const CBlock &block, unsigned int nHeight, const FlatFilePos &pos) EXCLUSIVE_LOCKS_REQUIRED(bool IsPruneMode() const
Get block file info entry for one block file.
Definition: blockstorage.h:407
BlockfileType BlockfileTypeForHeight(int height)
std::atomic_bool m_blockfiles_indexed
Whether all blockfiles have been added to the block tree database.
Definition: blockstorage.h:333
std::vector< CBlockIndex * > GetAllBlockIndices() EXCLUSIVE_LOCKS_REQUIRED(std::multimap< CBlockIndex *, CBlockIndex * > m_blocks_unlinked
All pairs A->B, where A (or one of its ancestors) misses transactions, but B has transactions.
Definition: blockstorage.h:351
const Consensus::Params & GetConsensus() const
Definition: blockstorage.h:202
BlockManager(const util::SignalInterrupt &interrupt, Options opts)
std::unordered_map< std::string, PruneLockInfo > m_prune_locks GUARDED_BY(::cs_main)
Map from external index name to oldest block that must not be pruned.
std::set< CBlockIndex * > m_dirty_blockindex
Dirty block index entries.
Definition: blockstorage.h:313
bool LoadingBlocks() const
Definition: blockstorage.h:413
fs::path GetBlockPosFilename(const FlatFilePos &pos) const
Translation to a filesystem path.
uint64_t GetPruneTarget() const
Attempt to stay below this number of bytes of block files.
Definition: blockstorage.h:410
void UnlinkPrunedFiles(const std::set< int > &setFilesToPrune) const
Actually unlink the specified files.
void WriteBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(bool LoadBlockIndexDB(const std::optional< uint256 > &snapshot_blockhash) EXCLUSIVE_LOCKS_REQUIRED(void ScanAndUnlinkAlreadyPrunedFiles() EXCLUSIVE_LOCKS_REQUIRED(CBlockIndex * AddToBlockIndex(const CBlockHeader &block, CBlockIndex *&best_header) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Remove any pruned block & undo files that are still on disk.
Definition: blockstorage.h:372
const bool m_prune_mode
Definition: blockstorage.h:290
bool FlushBlockFile(int blockfile_num, bool fFinalize, bool finalize_undo) EXCLUSIVE_LOCKS_REQUIRED(bool FlushUndoFile(int block_file, bool finalize=false)
Return false if block file or undo file flushing fails.
const util::SignalInterrupt & m_interrupt
Definition: blockstorage.h:324
ReadRawBlockResult ReadRawBlock(const FlatFilePos &pos, std::optional< std::pair< size_t, size_t > > block_part=std::nullopt) const
const FlatFileSeq m_block_file_seq
Definition: blockstorage.h:306
CBlockIndex * InsertBlockIndex(const uint256 &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Create a new block index entry for a given block hash.
bool ReadBlock(CBlock &block, const FlatFilePos &pos, const std::optional< uint256 > &expected_hash) const
Functions for disk access for blocks.
bool m_check_for_pruning
Global flag to indicate we should check to see if there are block/undo files that should be deleted.
Definition: blockstorage.h:288
void CleanupBlockRevFiles() const
std::atomic< bool > m_importing
Definition: blockstorage.h:325
bool IsBlockPruned(const CBlockIndex &block) const EXCLUSIVE_LOCKS_REQUIRED(void UpdatePruneLock(const std::string &name, const PruneLockInfo &lock_info) EXCLUSIVE_LOCKS_REQUIRED(bool DeletePruneLock(const std::string &name) EXCLUSIVE_LOCKS_REQUIRED(AutoFile OpenBlockFile(const FlatFilePos &pos, bool fReadOnly) const
Check whether the block associated with this index entry is pruned or not.
Definition: blockstorage.h:465
std::array< std::optional< BlockfileCursor >, BlockfileType::NUM_TYPES > m_blockfile_cursors GUARDED_BY(::cs_main)
Since assumedvalid chainstates may be syncing a range of the chain that is very far away from the nor...
std::vector< CBlockFileInfo > m_blockfile_info
Definition: blockstorage.h:310
void FindFilesToPruneManual(std::set< int > &setFilesToPrune, int nManualPruneHeight, const Chainstate &chain)
bool LoadBlockIndex(const std::optional< uint256 > &snapshot_blockhash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Load the blocktree off disk and into memory.
FlatFilePos FindNextBlockPos(unsigned int nAddSize, unsigned int nHeight, uint64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(bool FlushChainstateBlockFile(int tip_height) EXCLUSIVE_LOCKS_REQUIRED(bool FindUndoPos(BlockValidationState &state, int nFile, FlatFilePos &pos, unsigned int nAddSize) EXCLUSIVE_LOCKS_REQUIRED(AutoFile OpenUndoFile(const FlatFilePos &pos, bool fReadOnly=false) const
Helper function performing various preparations before a block can be saved to disk: Returns the corr...
Definition: blockstorage.h:230
std::optional< int > m_snapshot_height
The height of the base block of an assumeutxo snapshot, if one is in use.
Definition: blockstorage.h:349
uint64_t CalculateCurrentUsage() EXCLUSIVE_LOCKS_REQUIRED(bool CheckBlockDataAvailability(const CBlockIndex &upper_block, const CBlockIndex &lower_block, BlockStatus block_status=BLOCK_HAVE_DATA) EXCLUSIVE_LOCKS_REQUIRED(const CBlockIndex &GetFirstBlock(const CBlockIndex &upper_block LIFETIMEBOUND, uint32_t status_mask, const CBlockIndex *lower_block LIFETIMEBOUND=nullptr) const EXCLUSIVE_LOCKS_REQUIRED(boo m_have_pruned)
Calculate the amount of disk space the block & undo files currently use.
Definition: blockstorage.h:453
BlockMap m_block_index GUARDED_BY(cs_main)
256-bit opaque blob.
Definition: uint256.h:196
The util::Expected class provides a standard way for low-level functions to return either error value...
Definition: expected.h:44
Helper class that manages an interrupt flag, and allows a thread or signal to interrupt another threa...
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
Definition: cs_main.cpp:8
unsigned int nHeight
Transaction validation functions.
Definition: messages.h:21
static const unsigned int UNDOFILE_CHUNK_SIZE
The pre-allocation chunk size for rev?????.dat files (since 0.8)
Definition: blockstorage.h:124
BlockfileType
Definition: blockstorage.h:155
@ NUM_TYPES
Definition: blockstorage.h:159
@ NORMAL
Definition: blockstorage.h:157
@ ASSUMED
Definition: blockstorage.h:158
static const unsigned int BLOCKFILE_CHUNK_SIZE
The pre-allocation chunk size for blk?????.dat files (since 0.8)
Definition: blockstorage.h:122
static constexpr uint32_t STORAGE_HEADER_BYTES
Size of header written by WriteBlock before a serialized CBlock (8 bytes)
Definition: blockstorage.h:129
ReadRawError
Definition: blockstorage.h:183
std::ostream & operator<<(std::ostream &os, const BlockfileType &type)
static constexpr uint32_t UNDO_DATA_DISK_OVERHEAD
Total overhead when writing undo data: header (8 bytes) plus checksum (32 bytes)
Definition: blockstorage.h:132
std::unordered_map< uint256, CBlockIndex, BlockHasher > BlockMap
Definition: blockstorage.h:138
static const unsigned int MAX_BLOCKFILE_SIZE
The maximum size of a blk?????.dat file (since 0.8)
Definition: blockstorage.h:126
void ImportBlocks(ChainstateManager &chainman, std::span< const fs::path > import_paths)
const char * name
Definition: rest.cpp:49
#define VARINT(obj)
Definition: serialize.h:494
#define READWRITE(...)
Definition: serialize.h:148
Parameters that influence chain consensus.
Definition: params.h:87
An options struct for BlockManager, more ergonomically referred to as BlockManager::Options due to th...
const CChainParams & chainparams
bool operator()(const CBlockIndex *pa, const CBlockIndex *pb) const
bool operator()(const CBlockIndex *pa, const CBlockIndex *pb) const
int height_first
Height of earliest block that should be kept and not pruned.
Definition: blockstorage.h:152
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition: threadsafety.h:49
AssertLockHeld(pool.cs)