Skip to content
Bitcoin Roots

v29.4-roots.4 · Commit 3: [PATCH 03/37] policy: restore conservative relay and network controls

src/kernel/mempool_options.h

Before: src/kernel/mempool_options.h · After: src/kernel/mempool_options.h

File metadata
index d57dbb393f3b5de45fa820630af43e4f1cd66d9e..a23ec8a0ed588873513b63b62a3409514dfaa3af 100644

Download original patch · Release notes

Diff rows 1–83 of 83. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

src/kernel/mempool_options.h CHANGED
@@ -13,18 +13,35 @@
13
13
  #include <cstdint>
14
14
  #include <optional>
15
15
 
16
+ class CBlockPolicyEstimator;
17
+ class CScheduler;
16
18
  class ValidationSignals;
17
19
 
20
+ enum class RBFPolicy { Never, OptIn, Always };
21
+ enum class TRUCPolicy { Reject, Accept, Enforce };
22
+
18
23
  /** Default for -maxmempool, maximum megabytes of mempool memory usage */
19
24
  static constexpr unsigned int DEFAULT_MAX_MEMPOOL_SIZE_MB{300};
20
25
  /** Default for -maxmempool when blocksonly is set */
21
26
  static constexpr unsigned int DEFAULT_BLOCKSONLY_MAX_MEMPOOL_SIZE_MB{5};
22
27
  /** Default for -mempoolexpiry, expiration time for mempool transactions in hours */
23
28
  static constexpr unsigned int DEFAULT_MEMPOOL_EXPIRY_HOURS{336};
29
+ /** Default for -minrelaycoinblocks */
30
+ static constexpr uint64_t DEFAULT_MINRELAYCOINBLOCKS{0};
31
+ /** Default for -minrelaymaturity */
32
+ static constexpr int DEFAULT_MINRELAYMATURITY{0};
33
+ /** Default for -mempoolreplacement; must update docs in init.cpp manually */
34
+ static constexpr RBFPolicy DEFAULT_MEMPOOL_RBF_POLICY{RBFPolicy::Always};
35
+ /** Default for -mempooltruc; must update docs in init.cpp manually */
36
+ static constexpr TRUCPolicy DEFAULT_MEMPOOL_TRUC_POLICY{TRUCPolicy::Enforce};
24
37
  /** Whether to fall back to legacy V1 serialization when writing mempool.dat */
25
38
  static constexpr bool DEFAULT_PERSIST_V1_DAT{false};
39
+ /** Default for -acceptnonstddatacarrier */
40
+ static constexpr bool DEFAULT_ACCEPT_NON_STD_DATACARRIER{false};
26
41
  /** Default for -acceptnonstdtxn */
27
42
  static constexpr bool DEFAULT_ACCEPT_NON_STD_TXN{false};
43
+ /** Default for -acceptunknownwitness */
44
+ static constexpr bool DEFAULT_ACCEPTUNKNOWNWITNESS{true};
28
45
 
29
46
  namespace kernel {
30
47
  /**
@@ -35,14 +52,25 @@ namespace kernel {
35
52
  * Most of the time, this struct should be referenced as CTxMemPool::Options.
36
53
  */
37
54
  struct MemPoolOptions {
55
+ /* Used to estimate appropriate transaction fees. */
56
+ CBlockPolicyEstimator* estimator{nullptr};
57
+ CScheduler* scheduler{nullptr};
38
58
  /* The ratio used to determine how often sanity checks will run. */
39
59
  int check_ratio{0};
40
60
  int64_t max_size_bytes{DEFAULT_MAX_MEMPOOL_SIZE_MB * 1'000'000};
41
61
  std::chrono::seconds expiry{std::chrono::hours{DEFAULT_MEMPOOL_EXPIRY_HOURS}};
42
- CFeeRate incremental_relay_feerate{DEFAULT_INCREMENTAL_RELAY_FEE};
62
+ uint64_t minrelaycoinblocks{DEFAULT_MINRELAYCOINBLOCKS};
63
+ int minrelaymaturity{DEFAULT_MINRELAYMATURITY};
64
+ CFeeRate incremental_relay_feerate{CORE_INCREMENTAL_RELAY_FEE};
43
65
  /** A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) */
44
66
  CFeeRate min_relay_feerate{DEFAULT_MIN_RELAY_TX_FEE};
45
67
  CFeeRate dust_relay_feerate{DUST_RELAY_TX_FEE};
68
+ CFeeRate dust_relay_feerate_floor{DUST_RELAY_TX_FEE};
69
+ /** Negative for a target number of blocks, positive for target kB into current mempool. */
70
+ int32_t dust_relay_target{0};
71
+ /** Multiplier for dustdynamic assignments, in thousandths. */
72
+ int dust_relay_multiplier{DEFAULT_DUST_RELAY_MULTIPLIER};
73
+ unsigned int maxtxlegacysigops{MAX_TX_LEGACY_SIGOPS};
46
74
  /**
47
75
  * A data carrying output is an unspendable output containing data. The script
48
76
  * type is designated as TxoutType::NULL_DATA.
@@ -51,8 +79,22 @@ struct MemPoolOptions {
51
79
  * If nullopt, any size is nonstandard.
52
80
  */
53
81
  std::optional<unsigned> max_datacarrier_bytes{DEFAULT_ACCEPT_DATACARRIER ? std::optional{MAX_OP_RETURN_RELAY} : std::nullopt};
82
+ bool datacarrier_fullcount{DEFAULT_DATACARRIER_FULLCOUNT};
83
+ bool permitbaredatacarrier{DEFAULT_PERMITBAREDATACARRIER};
84
+ bool permitbareanchor{DEFAULT_PERMITBAREANCHOR};
85
+ bool permit_bare_pubkey{DEFAULT_PERMIT_BAREPUBKEY};
54
86
  bool permit_bare_multisig{DEFAULT_PERMIT_BAREMULTISIG};
87
+ bool reject_parasites{DEFAULT_REJECT_PARASITES};
88
+ bool reject_tokens{DEFAULT_REJECT_TOKENS};
89
+ bool subdustfeepenalty{DEFAULT_SUBDUSTFEEPENALTY};
90
+ bool accept_non_std_datacarrier{DEFAULT_ACCEPT_NON_STD_DATACARRIER};
55
91
  bool require_standard{true};
92
+ bool acceptunknownwitness{DEFAULT_ACCEPTUNKNOWNWITNESS};
93
+ RBFPolicy rbf_policy{DEFAULT_MEMPOOL_RBF_POLICY};
94
+ TRUCPolicy truc_policy{DEFAULT_MEMPOOL_TRUC_POLICY};
95
+ bool permitephemeral_anchor{DEFAULT_PERMITEPHEMERAL_ANCHOR};
96
+ bool permitephemeral_send{DEFAULT_PERMITEPHEMERAL_SEND};
97
+ bool permitephemeral_dust{DEFAULT_PERMITEPHEMERAL_DUST};
56
98
  bool persist_v1_dat{DEFAULT_PERSIST_V1_DAT};
57
99
  MemPoolLimits limits{};
58
100