![]() |
Bitcoin Core
24.99.0
P2P Digital Currency
|
Classes | |
class | ImportingNow |
struct | CBlockIndexWorkComparator |
struct | CBlockIndexHeightOnlyComparator |
struct | PruneLockInfo |
class | BlockManager |
Maintains a tree of blocks (stored in m_block_index ) which is consulted to determine where the most-work tip is. More... | |
struct | CacheSizes |
struct | ChainstateLoadOptions |
struct | NodeContext |
NodeContext struct containing references to chain state and connection state. More... | |
struct | CBlockTemplate |
struct | CTxMemPoolModifiedEntry |
struct | CompareCTxMemPoolIter |
Comparator for CTxMemPool::txiter objects. More... | |
struct | modifiedentry_iter |
struct | CompareTxIterByAncestorCount |
struct | update_for_parent_inclusion |
class | BlockAssembler |
Generate a new block, without valid proof-of-work. More... | |
struct | PSBTInputAnalysis |
Holds an analysis of one input from a PSBT. More... | |
struct | PSBTAnalysis |
Holds the results of AnalyzePSBT (miscellaneous information about a PSBT) More... | |
class | SnapshotMetadata |
Metadata describing a serialized version of a UTXO set from which an assumeutxo Chainstate can be constructed. More... | |
Typedefs | |
using | BlockMap = std::unordered_map< uint256, CBlockIndex, BlockHasher > |
using | ChainstateLoadResult = std::tuple< ChainstateLoadStatus, bilingual_str > |
Chainstate load status code and optional error string. More... | |
typedef boost::multi_index_container< CTxMemPoolModifiedEntry, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< modifiedentry_iter, CompareCTxMemPoolIter >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ancestor_score >, boost::multi_index::identity< CTxMemPoolModifiedEntry >, CompareTxMemPoolEntryByAncestorFee > >> | indexed_modified_transaction_set |
typedef indexed_modified_transaction_set::nth_index< 0 >::type::iterator | modtxiter |
typedef indexed_modified_transaction_set::index< ancestor_score >::type::iterator | modtxscoreiter |
Enumerations | |
enum class | ChainstateLoadStatus { SUCCESS , FAILURE , FAILURE_INCOMPATIBLE_DB , FAILURE_INSUFFICIENT_DBCACHE , INTERRUPTED } |
Chainstate load status. More... | |
Functions | |
std::optional< bilingual_str > | ApplyArgsManOptions (const ArgsManager &args, BlockManager::Options &opts) |
std::atomic_bool | fReindex (false) |
static FILE * | OpenUndoFile (const FlatFilePos &pos, bool fReadOnly) |
Open an undo file (rev?????.dat) More... | |
static FlatFileSeq | BlockFileSeq () |
static FlatFileSeq | UndoFileSeq () |
void | CleanupBlockRevFiles () |
static bool | UndoWriteToDisk (const CBlockUndo &blockundo, FlatFilePos &pos, const uint256 &hashBlock, const CMessageHeader::MessageStartChars &messageStart) |
bool | UndoReadFromDisk (CBlockUndo &blockundo, const CBlockIndex *pindex) |
void | UnlinkPrunedFiles (const std::set< int > &setFilesToPrune) |
Actually unlink the specified files. More... | |
FILE * | OpenBlockFile (const FlatFilePos &pos, bool fReadOnly=false) |
Open a block file (blk?????.dat) More... | |
fs::path | GetBlockPosFilename (const FlatFilePos &pos) |
Translation to a filesystem path. More... | |
static bool | WriteBlockToDisk (const CBlock &block, FlatFilePos &pos, const CMessageHeader::MessageStartChars &messageStart) |
bool | ReadBlockFromDisk (CBlock &block, const FlatFilePos &pos, const Consensus::Params &consensusParams) |
Functions for disk access for blocks. More... | |
bool | ReadBlockFromDisk (CBlock &block, const CBlockIndex *pindex, const Consensus::Params &consensusParams) |
bool | ReadRawBlockFromDisk (std::vector< uint8_t > &block, const FlatFilePos &pos, const CMessageHeader::MessageStartChars &message_start) |
void | ThreadImport (ChainstateManager &chainman, std::vector< fs::path > vImportFiles, const ArgsManager &args, const fs::path &mempool_path) |
CacheSizes | CalculateCacheSizes (const ArgsManager &args, size_t n_indexes) |
static ChainstateLoadResult | CompleteChainstateInitialization (ChainstateManager &chainman, const CacheSizes &cache_sizes, const ChainstateLoadOptions &options) EXCLUSIVE_LOCKS_REQUIRED( |
ChainstateLoadResult | LoadChainstate (ChainstateManager &chainman, const CacheSizes &cache_sizes, const ChainstateLoadOptions &options) |
This sequence can have 4 types of outcomes: More... | |
ChainstateLoadResult | VerifyLoadedChainstate (ChainstateManager &chainman, const ChainstateLoadOptions &options) |
std::optional< bilingual_str > | ApplyArgsManOptions (const ArgsManager &args, ChainstateManager::Options &opts) |
void | FindCoins (const node::NodeContext &node, std::map< COutPoint, Coin > &coins) |
Look up unspent output information. More... | |
void | ReadCoinsViewArgs (const ArgsManager &args, CoinsViewOptions &options) |
void | ReadDatabaseArgs (const ArgsManager &args, DBOptions &options) |
bool | ShouldPersistMempool (const ArgsManager &argsman) |
fs::path | MempoolPath (const ArgsManager &argsman) |
int64_t | UpdateTime (CBlockHeader *pblock, const Consensus::Params &consensusParams, const CBlockIndex *pindexPrev) |
void | RegenerateCommitments (CBlock &block, ChainstateManager &chainman) |
Update an old GenerateCoinbaseCommitment from CreateNewBlock after the block txs have changed. More... | |
static BlockAssembler::Options | ClampOptions (BlockAssembler::Options options) |
void | ApplyArgsManOptions (const ArgsManager &gArgs, BlockAssembler::Options &options) |
Apply -blockmintxfee and -blockmaxweight options from ArgsManager to BlockAssembler options. More... | |
static BlockAssembler::Options | ConfiguredOptions () |
static int | UpdatePackagesForAdded (const CTxMemPool &mempool, const CTxMemPool::setEntries &alreadyAdded, indexed_modified_transaction_set &mapModifiedTx) EXCLUSIVE_LOCKS_REQUIRED(mempool.cs) |
Add descendants of given transactions to mapModifiedTx with ancestor state updated assuming given transactions are inBlock. More... | |
Minisketch | MakeMinisketch32 (size_t capacity) |
Wrapper around Minisketch::Minisketch(32, implementation, capacity). More... | |
Minisketch | MakeMinisketch32FP (size_t max_elements, uint32_t fpbits) |
Wrapper around Minisketch::CreateFP. More... | |
PSBTAnalysis | AnalyzePSBT (PartiallySignedTransaction psbtx) |
Provides helpful miscellaneous information about where a PSBT is in the signing workflow. More... | |
static TransactionError | HandleATMPError (const TxValidationState &state, std::string &err_string_out) |
TransactionError | BroadcastTransaction (NodeContext &node, CTransactionRef tx, std::string &err_string, const CAmount &max_tx_fee, bool relay, bool wait_callback) |
Submit a transaction to the mempool and (optionally) relay it to all P2P peers. More... | |
CTransactionRef | GetTransaction (const CBlockIndex *const block_index, const CTxMemPool *const mempool, const uint256 &hash, const Consensus::Params &consensusParams, uint256 &hashBlock) |
Return transaction with a given hash. More... | |
bool | WriteSnapshotBaseBlockhash (Chainstate &snapshot_chainstate) |
std::optional< uint256 > | ReadSnapshotBaseBlockhash (fs::path chaindir) |
std::optional< fs::path > | FindSnapshotChainstateDir () |
Return a path to the snapshot-based chainstate dir, if one exists. More... | |
void | ApplyArgsManOptions (const ArgsManager &argsman, ValidationCacheSizes &cache_sizes) |
Variables | |
static constexpr bool | DEFAULT_STOPAFTERBLOCKIMPORT {false} |
static const unsigned int | BLOCKFILE_CHUNK_SIZE = 0x1000000 |
The pre-allocation chunk size for blk?????.dat files (since 0.8) More... | |
static const unsigned int | UNDOFILE_CHUNK_SIZE = 0x100000 |
The pre-allocation chunk size for rev?????.dat files (since 0.8) More... | |
static const unsigned int | MAX_BLOCKFILE_SIZE = 0x8000000 |
The maximum size of a blk?????.dat file (since 0.8) More... | |
static constexpr size_t | BLOCK_SERIALIZATION_HEADER_SIZE = CMessageHeader::MESSAGE_START_SIZE + sizeof(unsigned int) |
Size of header written by WriteBlockToDisk before a serialized CBlock. More... | |
std::atomic_bool | fReindex |
static constexpr bool | DEFAULT_PERSIST_MEMPOOL {true} |
Default for -persistmempool, indicating whether the node should attempt to automatically load the mempool on start and save to disk on shutdown. More... | |
static const bool | DEFAULT_PRINTPRIORITY = false |
static const CFeeRate | DEFAULT_MAX_RAW_TX_FEE_RATE {COIN / 10} |
Maximum fee rate for sendrawtransaction and testmempoolaccept RPC calls. More... | |
const fs::path | SNAPSHOT_BLOCKHASH_FILENAME {"base_blockhash"} |
The file in the snapshot chainstate dir which stores the base blockhash. More... | |
bool WriteSnapshotBaseBlockhash(Chainstate &snapshot_chainstate) EXCLUSIVE_LOCKS_REQUIRED(std::optional< uint256 > constexpr ReadSnapshotBaseBlockhash(fs::path chaindir) EXCLUSIVE_LOCKS_REQUIRED(std::string_view | SNAPSHOT_CHAINSTATE_SUFFIX = "_snapshot" |
Write out the blockhash of the snapshot base block that was used to construct this chainstate. More... | |
using node::BlockMap = typedef std::unordered_map<uint256, CBlockIndex, BlockHasher> |
Definition at line 56 of file blockstorage.h.
using node::ChainstateLoadResult = typedef std::tuple<ChainstateLoadStatus, bilingual_str> |
Chainstate load status code and optional error string.
Definition at line 52 of file chainstate.h.
typedef boost::multi_index_container< CTxMemPoolModifiedEntry, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< modifiedentry_iter, CompareCTxMemPoolIter >, boost::multi_index::ordered_non_unique< boost::multi_index::tag<ancestor_score>, boost::multi_index::identity<CTxMemPoolModifiedEntry>, CompareTxMemPoolEntryByAncestorFee > >> node::indexed_modified_transaction_set |
typedef indexed_modified_transaction_set::nth_index<0>::type::iterator node::modtxiter |
typedef indexed_modified_transaction_set::index<ancestor_score>::type::iterator node::modtxscoreiter |
|
strong |
Chainstate load status.
Simple applications can just check for the success case, and treat other cases as errors. More complex applications may want to try reindexing in the generic failure case, and pass an interrupt callback and exit cleanly in the interrupted case.
Enumerator | |
---|---|
SUCCESS | |
FAILURE | |
FAILURE_INCOMPATIBLE_DB | |
FAILURE_INSUFFICIENT_DBCACHE | |
INTERRUPTED |
Definition at line 43 of file chainstate.h.
PSBTAnalysis node::AnalyzePSBT | ( | PartiallySignedTransaction | psbtx | ) |
Provides helpful miscellaneous information about where a PSBT is in the signing workflow.
[in] | psbtx | the PSBT to analyze |
Definition at line 16 of file psbt.cpp.
std::optional< bilingual_str > node::ApplyArgsManOptions | ( | const ArgsManager & | args, |
BlockManager::Options & | opts | ||
) |
Definition at line 11 of file blockmanager_args.cpp.
std::optional< bilingual_str > node::ApplyArgsManOptions | ( | const ArgsManager & | args, |
ChainstateManager::Options & | opts | ||
) |
void node::ApplyArgsManOptions | ( | const ArgsManager & | argsman, |
ValidationCacheSizes & | cache_sizes | ||
) |
void node::ApplyArgsManOptions | ( | const ArgsManager & | args, |
BlockAssembler::Options & | options | ||
) |
Apply -blockmintxfee and -blockmaxweight options from ArgsManager to BlockAssembler options.
Definition at line 74 of file miner.cpp.
|
static |
Definition at line 585 of file blockstorage.cpp.
TransactionError node::BroadcastTransaction | ( | NodeContext & | node, |
CTransactionRef | tx, | ||
std::string & | err_string, | ||
const CAmount & | max_tx_fee, | ||
bool | relay, | ||
bool | wait_callback | ||
) |
Submit a transaction to the mempool and (optionally) relay it to all P2P peers.
Mempool submission can be synchronous (will await mempool entry notification over the CValidationInterface) or asynchronous (will submit and not wait for notification), depending on the value of wait_callback. wait_callback MUST NOT be set while cs_main, cs_mempool or cs_wallet are held to avoid deadlock.
[in] | node | reference to node context |
[in] | tx | the transaction to broadcast |
[out] | err_string | reference to std::string to fill with error string if available |
[in] | max_tx_fee | reject txs with fees higher than this (if 0, accept any fee) |
[in] | relay | flag if both mempool insertion and p2p relay are requested |
[in] | wait_callback | wait until callbacks have been processed to avoid stale result due to a sequentially RPC. return error |
Definition at line 33 of file transaction.cpp.
CacheSizes node::CalculateCacheSizes | ( | const ArgsManager & | args, |
size_t | n_indexes | ||
) |
Definition at line 12 of file caches.cpp.
|
static |
void node::CleanupBlockRevFiles | ( | ) |
Definition at line 425 of file blockstorage.cpp.
|
static |
Definition at line 33 of file chainstate.cpp.
|
static |
void node::FindCoins | ( | const node::NodeContext & | node, |
std::map< COutPoint, Coin > & | coins | ||
) |
Look up unspent output information.
Returns coins in the mempool and in the current chain UTXO set. Iterates through all the keys in the map and populates the values.
[in] | node | The node context to use for lookup |
[in,out] | coins | map to fill |
Definition at line 12 of file coin.cpp.
std::optional< fs::path > node::FindSnapshotChainstateDir | ( | ) |
Return a path to the snapshot-based chainstate dir, if one exists.
Definition at line 85 of file utxo_snapshot.cpp.
std::atomic_bool node::fReindex | ( | false | ) |
fs::path node::GetBlockPosFilename | ( | const FlatFilePos & | pos | ) |
Translation to a filesystem path.
Definition at line 606 of file blockstorage.cpp.
CTransactionRef node::GetTransaction | ( | const CBlockIndex *const | block_index, |
const CTxMemPool *const | mempool, | ||
const uint256 & | hash, | ||
const Consensus::Params & | consensusParams, | ||
uint256 & | hashBlock | ||
) |
Return transaction with a given hash.
If mempool is provided and block_index is not provided, check it first for the tx. If -txindex is available, check it next for the tx. Finally, if block_index is provided, check for tx by reading entire block from disk.
[in] | block_index | The block to read from disk, or nullptr |
[in] | mempool | If provided, check mempool for tx |
[in] | hash | The txid |
[in] | consensusParams | The params |
[out] | hashBlock | The block hash, if the tx was found via -txindex or block_index |
Definition at line 125 of file transaction.cpp.
|
static |
Definition at line 20 of file transaction.cpp.
ChainstateLoadResult node::LoadChainstate | ( | ChainstateManager & | chainman, |
const CacheSizes & | cache_sizes, | ||
const ChainstateLoadOptions & | options | ||
) |
This sequence can have 4 types of outcomes:
LoadChainstate returns a (status code, error string) tuple.
Definition at line 160 of file chainstate.cpp.
Minisketch node::MakeMinisketch32 | ( | size_t | capacity | ) |
Wrapper around Minisketch::Minisketch(32, implementation, capacity).
Definition at line 70 of file minisketchwrapper.cpp.
Minisketch node::MakeMinisketch32FP | ( | size_t | max_elements, |
uint32_t | fpbits | ||
) |
Wrapper around Minisketch::CreateFP.
Definition at line 75 of file minisketchwrapper.cpp.
fs::path node::MempoolPath | ( | const ArgsManager & | argsman | ) |
Definition at line 18 of file mempool_persist_args.cpp.
FILE * node::OpenBlockFile | ( | const FlatFilePos & | pos, |
bool | fReadOnly | ||
) |
Open a block file (blk?????.dat)
Definition at line 595 of file blockstorage.cpp.
|
static |
Open an undo file (rev?????.dat)
Definition at line 601 of file blockstorage.cpp.
bool node::ReadBlockFromDisk | ( | CBlock & | block, |
const CBlockIndex * | pindex, | ||
const Consensus::Params & | consensusParams | ||
) |
bool node::ReadBlockFromDisk | ( | CBlock & | block, |
const FlatFilePos & | pos, | ||
const Consensus::Params & | consensusParams | ||
) |
Functions for disk access for blocks.
Definition at line 741 of file blockstorage.cpp.
void node::ReadCoinsViewArgs | ( | const ArgsManager & | args, |
CoinsViewOptions & | options | ||
) |
void node::ReadDatabaseArgs | ( | const ArgsManager & | args, |
DBOptions & | options | ||
) |
Definition at line 11 of file database_args.cpp.
bool node::ReadRawBlockFromDisk | ( | std::vector< uint8_t > & | block, |
const FlatFilePos & | pos, | ||
const CMessageHeader::MessageStartChars & | message_start | ||
) |
Definition at line 50 of file utxo_snapshot.cpp.
void node::RegenerateCommitments | ( | CBlock & | block, |
ChainstateManager & | chainman | ||
) |
bool node::ShouldPersistMempool | ( | const ArgsManager & | argsman | ) |
Definition at line 13 of file mempool_persist_args.cpp.
void node::ThreadImport | ( | ChainstateManager & | chainman, |
std::vector< fs::path > | vImportFiles, | ||
const ArgsManager & | args, | ||
const fs::path & | mempool_path | ||
) |
Definition at line 863 of file blockstorage.cpp.
|
static |
Definition at line 590 of file blockstorage.cpp.
bool node::UndoReadFromDisk | ( | CBlockUndo & | blockundo, |
const CBlockIndex * | pindex | ||
) |
Definition at line 498 of file blockstorage.cpp.
|
static |
void node::UnlinkPrunedFiles | ( | const std::set< int > & | setFilesToPrune | ) |
Actually unlink the specified files.
Definition at line 572 of file blockstorage.cpp.
|
static |
int64_t node::UpdateTime | ( | CBlockHeader * | pblock, |
const Consensus::Params & | consensusParams, | ||
const CBlockIndex * | pindexPrev | ||
) |
ChainstateLoadResult node::VerifyLoadedChainstate | ( | ChainstateManager & | chainman, |
const ChainstateLoadOptions & | options | ||
) |
Definition at line 238 of file chainstate.cpp.
|
static |
bool node::WriteSnapshotBaseBlockhash | ( | Chainstate & | snapshot_chainstate | ) |
Definition at line 24 of file utxo_snapshot.cpp.
|
staticconstexpr |
Size of header written by WriteBlockToDisk before a serialized CBlock.
Definition at line 48 of file blockstorage.h.
|
static |
The pre-allocation chunk size for blk?????.dat files (since 0.8)
Definition at line 41 of file blockstorage.h.
Maximum fee rate for sendrawtransaction and testmempoolaccept RPC calls.
Also used by the GUI when broadcasting a completed PSBT. By default, a transaction with a fee rate higher than this will be rejected by these RPCs and the GUI. This can be overridden with the maxfeerate argument.
Definition at line 26 of file transaction.h.
|
staticconstexpr |
Default for -persistmempool, indicating whether the node should attempt to automatically load the mempool on start and save to disk on shutdown.
Definition at line 18 of file mempool_persist_args.h.
|
staticconstexpr |
Definition at line 38 of file blockstorage.h.
|
extern |
|
static |
The maximum size of a blk?????.dat file (since 0.8)
Definition at line 45 of file blockstorage.h.
const fs::path node::SNAPSHOT_BLOCKHASH_FILENAME {"base_blockhash"} |
The file in the snapshot chainstate dir which stores the base blockhash.
This is needed to reconstruct snapshot chainstates on init.
Because we only allow loading a single snapshot at a time, there will only be one chainstate directory with this filename present within it.
Definition at line 51 of file utxo_snapshot.h.
|
constexpr |
Write out the blockhash of the snapshot base block that was used to construct this chainstate.
This value is read in during subsequent initializations and used to reconstruct snapshot-based chainstates. Read the blockhash of the snapshot base block that was used to construct the chainstate. Suffix appended to the chainstate (leveldb) dir when created based upon a snapshot.
Definition at line 66 of file utxo_snapshot.h.
|
static |
The pre-allocation chunk size for rev?????.dat files (since 0.8)
Definition at line 43 of file blockstorage.h.