Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show All 9 Lines | |||||
#if defined(HAVE_CONFIG_H) | #if defined(HAVE_CONFIG_H) | ||||
#include <config/bitcoin-config.h> | #include <config/bitcoin-config.h> | ||||
#endif | #endif | ||||
#include <arith_uint256.h> | #include <arith_uint256.h> | ||||
#include <attributes.h> | #include <attributes.h> | ||||
#include <blockfileinfo.h> | #include <blockfileinfo.h> | ||||
#include <blockindexcomparators.h> | #include <blockindexcomparators.h> | ||||
#include <bloom.h> | |||||
#include <chain.h> | #include <chain.h> | ||||
#include <consensus/amount.h> | #include <consensus/amount.h> | ||||
#include <consensus/consensus.h> | #include <consensus/consensus.h> | ||||
#include <disconnectresult.h> | #include <disconnectresult.h> | ||||
#include <flatfile.h> | #include <flatfile.h> | ||||
#include <fs.h> | #include <fs.h> | ||||
#include <node/blockstorage.h> | #include <node/blockstorage.h> | ||||
#include <policy/packages.h> | #include <policy/packages.h> | ||||
▲ Show 20 Lines • Show All 658 Lines • ▼ Show 20 Lines | private: | ||||
/** | /** | ||||
* The best block via avalanche voting. | * The best block via avalanche voting. | ||||
* This block cannot be reorged in any way except by explicit user action. | * This block cannot be reorged in any way except by explicit user action. | ||||
*/ | */ | ||||
const CBlockIndex *m_avalancheFinalizedBlockIndex | const CBlockIndex *m_avalancheFinalizedBlockIndex | ||||
GUARDED_BY(cs_avalancheFinalizedBlockIndex) = nullptr; | GUARDED_BY(cs_avalancheFinalizedBlockIndex) = nullptr; | ||||
/** | |||||
* Filter to prevent parking a block due to block policies more than once. | |||||
* After first application of block policies, Avalanche voting will | |||||
* determine the final acceptance state. Rare false positives will be | |||||
* reconciled by the network and should not have any negative impact. | |||||
*/ | |||||
CRollingBloomFilter m_filterParkingPresetsApplied = | |||||
CRollingBloomFilter{1000, 0.000001}; | |||||
public: | public: | ||||
//! Reference to a BlockManager instance which itself is shared across all | //! Reference to a BlockManager instance which itself is shared across all | ||||
//! CChainState instances. | //! CChainState instances. | ||||
node::BlockManager &m_blockman; | node::BlockManager &m_blockman; | ||||
/** Chain parameters for this chainstate */ | /** Chain parameters for this chainstate */ | ||||
const CChainParams &m_params; | const CChainParams &m_params; | ||||
▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | public: | ||||
// Block (dis)connection on a given view: | // Block (dis)connection on a given view: | ||||
DisconnectResult DisconnectBlock(const CBlock &block, | DisconnectResult DisconnectBlock(const CBlock &block, | ||||
const CBlockIndex *pindex, | const CBlockIndex *pindex, | ||||
CCoinsViewCache &view) | CCoinsViewCache &view) | ||||
EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | EXCLUSIVE_LOCKS_REQUIRED(::cs_main); | ||||
bool ConnectBlock(const CBlock &block, BlockValidationState &state, | bool ConnectBlock(const CBlock &block, BlockValidationState &state, | ||||
CBlockIndex *pindex, CCoinsViewCache &view, | CBlockIndex *pindex, CCoinsViewCache &view, | ||||
BlockValidationOptions options, bool fJustCheck = false) | BlockValidationOptions options, | ||||
Amount *blockFees = nullptr, bool fJustCheck = false) | |||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
// Apply the effects of a block disconnection on the UTXO set. | // Apply the effects of a block disconnection on the UTXO set. | ||||
bool DisconnectTip(BlockValidationState &state, | bool DisconnectTip(BlockValidationState &state, | ||||
DisconnectedBlockTransactions *disconnectpool) | DisconnectedBlockTransactions *disconnectpool) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool->cs); | EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool->cs); | ||||
// Manual block validity manipulation: | // Manual block validity manipulation: | ||||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | bool ActivateBestChainStep(const Config &config, | ||||
CBlockIndex *pindexMostWork, | CBlockIndex *pindexMostWork, | ||||
const std::shared_ptr<const CBlock> &pblock, | const std::shared_ptr<const CBlock> &pblock, | ||||
bool &fInvalidFound, ConnectTrace &connectTrace) | bool &fInvalidFound, ConnectTrace &connectTrace) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool->cs); | EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool->cs); | ||||
bool ConnectTip(const Config &config, BlockValidationState &state, | bool ConnectTip(const Config &config, BlockValidationState &state, | ||||
CBlockIndex *pindexNew, | CBlockIndex *pindexNew, | ||||
const std::shared_ptr<const CBlock> &pblock, | const std::shared_ptr<const CBlock> &pblock, | ||||
ConnectTrace &connectTrace, | ConnectTrace &connectTrace, | ||||
DisconnectedBlockTransactions &disconnectpool) | DisconnectedBlockTransactions &disconnectpool, | ||||
Amount *blockFees) | |||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool->cs); | EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool->cs); | ||||
void InvalidBlockFound(CBlockIndex *pindex, | void InvalidBlockFound(CBlockIndex *pindex, | ||||
const BlockValidationState &state) | const BlockValidationState &state) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
CBlockIndex * | CBlockIndex * | ||||
FindMostWorkChain(std::vector<const CBlockIndex *> &blocksToReconcile) | FindMostWorkChain(std::vector<const CBlockIndex *> &blocksToReconcile) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
void ReceivedBlockTransactions(const CBlock &block, CBlockIndex *pindexNew, | void ReceivedBlockTransactions(const CBlock &block, CBlockIndex *pindexNew, | ||||
▲ Show 20 Lines • Show All 317 Lines • Show Last 20 Lines |