Skip to content

Commit 507b36d

Browse files
committed
[validation] Move all const declarations to top of validation.h
1 parent 0109622 commit 507b36d

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

src/validation.h

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,11 @@ static const unsigned int DEFAULT_DESCENDANT_SIZE_LIMIT = 101;
6464
static const unsigned int DEFAULT_MEMPOOL_EXPIRY = 336;
6565
/** The maximum size of a blk?????.dat file (since 0.8) */
6666
static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB
67-
6867
/** Maximum number of dedicated script-checking threads allowed */
6968
static const int MAX_SCRIPTCHECK_THREADS = 15;
7069
/** -par default (number of script-checking threads, 0 = auto) */
7170
static const int DEFAULT_SCRIPTCHECK_THREADS = 0;
72-
7371
static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60;
74-
7572
static const bool DEFAULT_CHECKPOINTS_ENABLED = true;
7673
static const bool DEFAULT_TXINDEX = false;
7774
static const char* const DEFAULT_BLOCKFILTERINDEX = "0";
@@ -80,9 +77,21 @@ static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100;
8077
static const bool DEFAULT_PERSIST_MEMPOOL = true;
8178
/** Default for using fee filter */
8279
static const bool DEFAULT_FEEFILTER = true;
83-
8480
/** Default for -stopatheight */
8581
static const int DEFAULT_STOPATHEIGHT = 0;
82+
/** Block files containing a block-height within MIN_BLOCKS_TO_KEEP of ::ChainActive().Tip() will not be pruned. */
83+
static const unsigned int MIN_BLOCKS_TO_KEEP = 288;
84+
static const signed int DEFAULT_CHECKBLOCKS = 6;
85+
static const unsigned int DEFAULT_CHECKLEVEL = 3;
86+
// Require that user allocate at least 550 MiB for block & undo files (blk???.dat and rev???.dat)
87+
// At 1MB per block, 288 blocks = 288MB.
88+
// Add 15% for Undo data = 331MB
89+
// Add 20% for Orphan block rate = 397MB
90+
// We want the low water mark after pruning to be at least 397 MB and since we prune in
91+
// full block file chunks, we need the high water mark which triggers the prune to be
92+
// one 128MB block file + added 15% undo data = 147MB greater for a total of 545MB
93+
// Setting the target to >= 550 MiB will make it likely we can respect the target.
94+
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024;
8695

8796
struct BlockHasher
8897
{
@@ -130,21 +139,6 @@ extern bool fHavePruned;
130139
extern bool fPruneMode;
131140
/** Number of MiB of block files that we're trying to stay below. */
132141
extern uint64_t nPruneTarget;
133-
/** Block files containing a block-height within MIN_BLOCKS_TO_KEEP of ::ChainActive().Tip() will not be pruned. */
134-
static const unsigned int MIN_BLOCKS_TO_KEEP = 288;
135-
136-
static const signed int DEFAULT_CHECKBLOCKS = 6;
137-
static const unsigned int DEFAULT_CHECKLEVEL = 3;
138-
139-
// Require that user allocate at least 550 MiB for block & undo files (blk???.dat and rev???.dat)
140-
// At 1MB per block, 288 blocks = 288MB.
141-
// Add 15% for Undo data = 331MB
142-
// Add 20% for Orphan block rate = 397MB
143-
// We want the low water mark after pruning to be at least 397 MB and since we prune in
144-
// full block file chunks, we need the high water mark which triggers the prune to be
145-
// one 128MB block file + added 15% undo data = 147MB greater for a total of 545MB
146-
// Setting the target to >= 550 MiB will make it likely we can respect the target.
147-
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024;
148142

149143
/**
150144
* Process an incoming block. This only returns after the best known valid

0 commit comments

Comments
 (0)