@@ -20,41 +20,55 @@ class CFeeRate;
2020class CScript ;
2121
2222/* * Default for -blockmaxsize, which controls the maximum size of block the mining code will create **/
23- static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 2000000 ;
23+ static constexpr unsigned int DEFAULT_BLOCK_MAX_SIZE{ 2000000 } ;
2424/* * Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by mining code **/
25- static const unsigned int DEFAULT_BLOCK_MIN_TX_FEE = 1000 ;
25+ static constexpr unsigned int DEFAULT_BLOCK_MIN_TX_FEE{ 1000 } ;
2626/* * The maximum size for transactions we're willing to relay/mine */
27- static const unsigned int MAX_STANDARD_TX_SIZE = 100000 ;
27+ static constexpr unsigned int MAX_STANDARD_TX_SIZE{ 100000 } ;
2828/* * The minimum size for transactions we're willing to relay/mine (1 empty scriptSig input + 1 P2SH output = 83 bytes) */
29- static const unsigned int MIN_STANDARD_TX_SIZE = 83 ;
29+ static constexpr unsigned int MIN_STANDARD_TX_SIZE{ 83 } ;
3030/* * Maximum number of signature check operations in an IsStandard() P2SH script */
31- static const unsigned int MAX_P2SH_SIGOPS = 15 ;
31+ static constexpr unsigned int MAX_P2SH_SIGOPS{ 15 } ;
3232/* * The maximum number of sigops we're willing to relay/mine in a single tx */
33- static const unsigned int MAX_STANDARD_TX_SIGOPS = 4000 ;
33+ static constexpr unsigned int MAX_STANDARD_TX_SIGOPS{ 4000 } ;
3434/* * Default for -maxmempool, maximum megabytes of mempool memory usage */
35- static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300 ;
35+ static constexpr unsigned int DEFAULT_MAX_MEMPOOL_SIZE{ 300 } ;
3636/* * Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or BIP 125 replacement **/
37- static const unsigned int DEFAULT_INCREMENTAL_RELAY_FEE = 1000 ;
37+ static constexpr unsigned int DEFAULT_INCREMENTAL_RELAY_FEE{ 1000 } ;
3838/* * Default for -bytespersigop */
39- static const unsigned int DEFAULT_BYTES_PER_SIGOP = 20 ;
39+ static constexpr unsigned int DEFAULT_BYTES_PER_SIGOP{ 20 } ;
4040/* * Default for -permitbaremultisig */
41- static const bool DEFAULT_PERMIT_BAREMULTISIG = true ;
41+ static constexpr bool DEFAULT_PERMIT_BAREMULTISIG{ true } ;
4242/* * The maximum size of a standard ScriptSig */
43- static const unsigned int MAX_STANDARD_SCRIPTSIG_SIZE = 1650 ;
43+ static constexpr unsigned int MAX_STANDARD_SCRIPTSIG_SIZE{ 1650 } ;
4444/* * Min feerate for defining dust. Historically this has been based on the
4545 * minRelayTxFee, however changing the dust limit changes which transactions are
4646 * standard and should be done with care and ideally rarely. It makes sense to
4747 * only increase the dust limit after prior releases were already not creating
4848 * outputs below the new threshold */
49- static const unsigned int DUST_RELAY_TX_FEE = 3000 ;
49+ static constexpr unsigned int DUST_RELAY_TX_FEE{ 3000 } ;
5050/* * Default for -minrelaytxfee, minimum relay fee for transactions */
51- static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000 ;
51+ static constexpr unsigned int DEFAULT_MIN_RELAY_TX_FEE{1000 };
52+ /* * Default for -limitancestorcount, max number of in-mempool ancestors */
53+ static constexpr unsigned int DEFAULT_ANCESTOR_LIMIT{25 };
54+ /* * Default for -limitancestorsize, maximum kilobytes of tx + all in-mempool ancestors */
55+ static constexpr unsigned int DEFAULT_ANCESTOR_SIZE_LIMIT{101 };
56+ /* * Default for -limitdescendantcount, max number of in-mempool descendants */
57+ static constexpr unsigned int DEFAULT_DESCENDANT_LIMIT{25 };
58+ /* * Default for -limitdescendantsize, maximum kilobytes of in-mempool descendants */
59+ static constexpr unsigned int DEFAULT_DESCENDANT_SIZE_LIMIT{101 };
60+ /* *
61+ * An extra transaction can be added to a package, as long as it only has one
62+ * ancestor and is no larger than this. Not really any reason to make this
63+ * configurable as it doesn't materially change DoS parameters.
64+ */
65+ static constexpr unsigned int EXTRA_DESCENDANT_TX_SIZE_LIMIT{10000 };
5266/* *
5367 * Standard script verification flags that standard transactions will comply
5468 * with. However scripts violating these flags may still be present in valid
5569 * blocks and we must accept those blocks.
5670 */
57- static constexpr unsigned int STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VERIFY_FLAGS |
71+ static constexpr unsigned int STANDARD_SCRIPT_VERIFY_FLAGS{ MANDATORY_SCRIPT_VERIFY_FLAGS |
5872 SCRIPT_VERIFY_DERSIG |
5973 SCRIPT_VERIFY_STRICTENC |
6074 SCRIPT_VERIFY_MINIMALDATA |
@@ -65,13 +79,13 @@ static constexpr unsigned int STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VE
6579 SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY |
6680 SCRIPT_VERIFY_CHECKSEQUENCEVERIFY |
6781 SCRIPT_VERIFY_LOW_S |
68- SCRIPT_VERIFY_CONST_SCRIPTCODE;
82+ SCRIPT_VERIFY_CONST_SCRIPTCODE} ;
6983
7084/* * For convenience, standard but not mandatory verify flags. */
71- static constexpr unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS;
85+ static constexpr unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS{ STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS} ;
7286
7387/* * Used as the flags parameter to sequence and nLocktime checks in non-consensus code. */
74- static constexpr unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS = LOCKTIME_VERIFY_SEQUENCE;
88+ static constexpr unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS{ LOCKTIME_VERIFY_SEQUENCE} ;
7589
7690CAmount GetDustThreshold (const CTxOut& txout, const CFeeRate& dustRelayFee);
7791
0 commit comments