diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -94,25 +94,33 @@ /** Number of blocks that can be requested at any given time from a single peer. */ static const int MAX_BLOCKS_IN_TRANSIT_PER_PEER = 16; -/** Timeout in seconds during which a peer must stall block download progress - * before being disconnected. */ +/** + * Timeout in seconds during which a peer must stall block download progress + * before being disconnected. + */ static const unsigned int BLOCK_STALLING_TIMEOUT = 2; -/** Number of headers sent in one getheaders result. We rely on the assumption - * that if a peer sends - * less than this number, we reached its tip. Changing this value is a protocol - * upgrade. */ +/** + * Number of headers sent in one getheaders result. We rely on the assumption + * that if a peer sends less than this number, we reached its tip. Changing this + * value is a protocol upgrade. + */ static const unsigned int MAX_HEADERS_RESULTS = 2000; -/** Maximum depth of blocks we're willing to serve as compact blocks to peers - * when requested. For older blocks, a regular BLOCK response will be sent. */ +/** + * Maximum depth of blocks we're willing to serve as compact blocks to peers + * when requested. For older blocks, a regular BLOCK response will be sent. + */ static const int MAX_CMPCTBLOCK_DEPTH = 5; -/** Maximum depth of blocks we're willing to respond to GETBLOCKTXN requests - * for. */ +/** + * Maximum depth of blocks we're willing to respond to GETBLOCKTXN requests for. + */ static const int MAX_BLOCKTXN_DEPTH = 10; -/** Size of the "block download window": how far ahead of our current height do +/** + * Size of the "block download window": how far ahead of our current height do * we fetch ? Larger windows tolerate larger download speed differences between * peer, but increase the potential degree of disordering of blocks on disk * (which make reindexing and in the future perhaps pruning harder). We'll - * probably want to make this a per-peer adaptive value at some point. */ + * probably want to make this a per-peer adaptive value at some point. + */ static const unsigned int BLOCK_DOWNLOAD_WINDOW = 1024; /** Time to wait (in seconds) between writing blocks/block index to disk. */ static const unsigned int DATABASE_WRITE_INTERVAL = 60 * 60; @@ -124,12 +132,16 @@ static const unsigned int AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL = 24 * 24 * 60; /** Average delay between peer address broadcasts in seconds. */ static const unsigned int AVG_ADDRESS_BROADCAST_INTERVAL = 30; -/** Average delay between trickled inventory transmissions in seconds. - * Blocks and whitelisted receivers bypass this, outbound peers get half this - * delay. */ +/** + * Average delay between trickled inventory transmissions in seconds. + * Blocks and whitelisted receivers bypass this, outbound peers get half this + * delay. + */ static const unsigned int INVENTORY_BROADCAST_INTERVAL = 5; -/** Maximum number of inventory items to send per transmission. - * Limits the impact of low-fee transaction floods. */ +/** + * Maximum number of inventory items to send per transmission. + * Limits the impact of low-fee transaction floods. + */ static const unsigned int INVENTORY_BROADCAST_MAX = 7 * INVENTORY_BROADCAST_INTERVAL; /** Average delay between feefilter broadcasts in seconds. */ @@ -139,15 +151,18 @@ /** Block download timeout base, expressed in millionths of the block interval * (i.e. 10 min) */ static const int64_t BLOCK_DOWNLOAD_TIMEOUT_BASE = 1000000; -/** Additional block download timeout per parallel downloading peer (i.e. 5 min) +/** + * Additional block download timeout per parallel downloading peer (i.e. 5 min) */ static const int64_t BLOCK_DOWNLOAD_TIMEOUT_PER_PEER = 500000; static const unsigned int DEFAULT_LIMITFREERELAY = 0; static const bool DEFAULT_RELAYPRIORITY = true; static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60; -/** Maximum age of our tip in seconds for us to be considered current for fee - * estimation */ +/** + * Maximum age of our tip in seconds for us to be considered current for fee + * estimation. + */ static const int64_t MAX_FEE_ESTIMATION_TIP_AGE = 3 * 60 * 60; /** Default for -permitbaremultisig */ @@ -161,8 +176,10 @@ /** Default for using fee filter */ static const bool DEFAULT_FEEFILTER = true; -/** Maximum number of headers to announce when relaying blocks with headers - * message.*/ +/** + * Maximum number of headers to announce when relaying blocks with headers + * message. + */ static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8; /** Maximum number of unconnecting headers announcements before DoS score */ @@ -191,14 +208,20 @@ extern bool fCheckpointsEnabled; extern size_t nCoinCacheUsage; -/** A fee rate smaller than this is considered zero fee (for relaying, mining - * and transaction creation) */ +/** + * A fee rate smaller than this is considered zero fee (for relaying, mining and + * transaction creation) + */ extern CFeeRate minRelayTxFee; -/** Absolute maximum transaction fee (in satoshis) used by wallet and mempool - * (rejects high fee in sendrawtransaction) */ +/** + * Absolute maximum transaction fee (in satoshis) used by wallet and mempool + * (rejects high fee in sendrawtransaction) + */ extern Amount maxTxFee; -/** If the tip is older than this (in seconds), the node is considered to be in - * initial block download. */ +/** + * If the tip is older than this (in seconds), the node is considered to be in + * initial block download. + */ extern int64_t nMaxTipAge; /** @@ -234,16 +257,18 @@ static const signed int DEFAULT_CHECKBLOCKS = 6; static const unsigned int DEFAULT_CHECKLEVEL = 3; -// Require that user allocate at least 550MB 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 > than 550MB will make it likely -// we can respect the target. +/** + * Require that user allocate at least 550MB 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 > than 550MB will make it likely + * we can respect the target. + */ static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024; /** diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -57,7 +57,6 @@ /** * Global state */ - CCriticalSection cs_main; BlockMap mapBlockIndex; @@ -2390,7 +2389,8 @@ } /** - * Update chainActive and related internal data structures when adding a new block to the chain tip. + * Update chainActive and related internal data structures when adding a new + * block to the chain tip. */ static void UpdateTip(const Config &config, CBlockIndex *pindexNew) { const Consensus::Params &consensusParams =