Changeset View
Changeset View
Standalone View
Standalone View
src/validation.h
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
static const Amount DEFAULT_UTXO_FEE = Amount::zero(); | static const Amount DEFAULT_UTXO_FEE = Amount::zero(); | ||||
/** | /** | ||||
* Default for -mempoolexpiry, expiration time for mempool transactions in | * Default for -mempoolexpiry, expiration time for mempool transactions in | ||||
* hours. | * hours. | ||||
*/ | */ | ||||
static const unsigned int DEFAULT_MEMPOOL_EXPIRY = 336; | static const unsigned int DEFAULT_MEMPOOL_EXPIRY = 336; | ||||
/** The maximum size of a blk?????.dat file (since 0.8) */ | /** The maximum size of a blk?????.dat file (since 0.8) */ | ||||
static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB | static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB | ||||
/** Maximum number of dedicated script-checking threads allowed */ | /** Maximum number of dedicated script-checking threads allowed */ | ||||
static const int MAX_SCRIPTCHECK_THREADS = 15; | static const int MAX_SCRIPTCHECK_THREADS = 15; | ||||
/** -par default (number of script-checking threads, 0 = auto) */ | /** -par default (number of script-checking threads, 0 = auto) */ | ||||
static const int DEFAULT_SCRIPTCHECK_THREADS = 0; | static const int DEFAULT_SCRIPTCHECK_THREADS = 0; | ||||
static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60; | static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60; | ||||
static const bool DEFAULT_CHECKPOINTS_ENABLED = true; | static const bool DEFAULT_CHECKPOINTS_ENABLED = true; | ||||
static const bool DEFAULT_TXINDEX = false; | static const bool DEFAULT_TXINDEX = false; | ||||
static const char *const DEFAULT_BLOCKFILTERINDEX = "0"; | static const char *const DEFAULT_BLOCKFILTERINDEX = "0"; | ||||
/** Default for -persistmempool */ | /** Default for -persistmempool */ | ||||
static const bool DEFAULT_PERSIST_MEMPOOL = true; | static const bool DEFAULT_PERSIST_MEMPOOL = true; | ||||
/** Default for using fee filter */ | /** Default for using fee filter */ | ||||
static const bool DEFAULT_FEEFILTER = true; | static const bool DEFAULT_FEEFILTER = true; | ||||
static const bool DEFAULT_PEERBLOOMFILTERS = true; | static const bool DEFAULT_PEERBLOOMFILTERS = true; | ||||
/** Default for -stopatheight */ | /** Default for -stopatheight */ | ||||
static const int DEFAULT_STOPATHEIGHT = 0; | static const int DEFAULT_STOPATHEIGHT = 0; | ||||
/** Default for -maxreorgdepth */ | /** Default for -maxreorgdepth */ | ||||
static const int DEFAULT_MAX_REORG_DEPTH = 10; | static const int DEFAULT_MAX_REORG_DEPTH = 10; | ||||
/** | /** | ||||
* Default for -finalizationdelay | * Default for -finalizationdelay | ||||
* This is the minimum time between a block header reception and the block | * This is the minimum time between a block header reception and the block | ||||
* finalization. | * finalization. | ||||
* This value should be >> block propagation and validation time | * This value should be >> block propagation and validation time | ||||
*/ | */ | ||||
static const int64_t DEFAULT_MIN_FINALIZATION_DELAY = 2 * 60 * 60; | static const int64_t DEFAULT_MIN_FINALIZATION_DELAY = 2 * 60 * 60; | ||||
/** | |||||
* Block files containing a block-height within MIN_BLOCKS_TO_KEEP of | |||||
* ::ChainActive().Tip() will not be pruned. | |||||
*/ | |||||
static const unsigned int MIN_BLOCKS_TO_KEEP = 288; | |||||
static const signed int DEFAULT_CHECKBLOCKS = 6; | |||||
static const unsigned int DEFAULT_CHECKLEVEL = 3; | |||||
/** | |||||
* Require that user allocate at least 550 MiB for block & undo files | |||||
* (blk???.dat and rev???.dat) | |||||
* At 1MB per block, 288 blocks = 288MB. | |||||
* Add 15% for Undo data = 331MB | |||||
* Add 20% for Orphan block rate = 397MB | |||||
* We want the low water mark after pruning to be at least 397 MB and since we | |||||
* prune in full block file chunks, we need the high water mark which triggers | |||||
* the prune to be one 128MB block file + added 15% undo data = 147MB greater | |||||
* for a total of 545MB | |||||
* Setting the target to >= 550 MiB will make it likely we can respect the | |||||
* target. | |||||
*/ | |||||
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024; | |||||
/** Current sync state passed to tip changed callbacks. */ | /** Current sync state passed to tip changed callbacks. */ | ||||
enum class SynchronizationState { INIT_REINDEX, INIT_DOWNLOAD, POST_INIT }; | enum class SynchronizationState { INIT_REINDEX, INIT_DOWNLOAD, POST_INIT }; | ||||
extern RecursiveMutex cs_main; | extern RecursiveMutex cs_main; | ||||
extern CTxMemPool g_mempool; | extern CTxMemPool g_mempool; | ||||
typedef std::unordered_map<BlockHash, CBlockIndex *, BlockHasher> BlockMap; | typedef std::unordered_map<BlockHash, CBlockIndex *, BlockHasher> BlockMap; | ||||
extern Mutex g_best_block_mutex; | extern Mutex g_best_block_mutex; | ||||
Show All 35 Lines | |||||
/** Pruning-related variables and constants */ | /** Pruning-related variables and constants */ | ||||
/** True if any block files have ever been pruned. */ | /** True if any block files have ever been pruned. */ | ||||
extern bool fHavePruned; | extern bool fHavePruned; | ||||
/** True if we're running in -prune mode. */ | /** True if we're running in -prune mode. */ | ||||
extern bool fPruneMode; | extern bool fPruneMode; | ||||
/** Number of MiB of block files that we're trying to stay below. */ | /** Number of MiB of block files that we're trying to stay below. */ | ||||
extern uint64_t nPruneTarget; | extern uint64_t nPruneTarget; | ||||
/** | |||||
* Block files containing a block-height within MIN_BLOCKS_TO_KEEP of | |||||
* ::ChainActive().Tip() will not be pruned. | |||||
*/ | |||||
static const unsigned int MIN_BLOCKS_TO_KEEP = 288; | |||||
static const signed int DEFAULT_CHECKBLOCKS = 6; | |||||
static const unsigned int DEFAULT_CHECKLEVEL = 3; | |||||
/** | |||||
* Require that user allocate at least 550 MiB for block & undo files | |||||
* (blk???.dat and rev???.dat) | |||||
* At 1MB per block, 288 blocks = 288MB. | |||||
* Add 15% for Undo data = 331MB | |||||
* Add 20% for Orphan block rate = 397MB | |||||
* We want the low water mark after pruning to be at least 397 MB and since we | |||||
* prune in full block file chunks, we need the high water mark which triggers | |||||
* the prune to be one 128MB block file + added 15% undo data = 147MB greater | |||||
* for a total of 545MB | |||||
* Setting the target to >= 550 MiB will make it likely we can respect the | |||||
* target. | |||||
*/ | |||||
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024; | |||||
class BlockValidationOptions { | class BlockValidationOptions { | ||||
private: | private: | ||||
uint64_t excessiveBlockSize; | uint64_t excessiveBlockSize; | ||||
bool checkPoW : 1; | bool checkPoW : 1; | ||||
bool checkMerkleRoot : 1; | bool checkMerkleRoot : 1; | ||||
public: | public: | ||||
▲ Show 20 Lines • Show All 1,050 Lines • Show Last 20 Lines |