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. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
src/kernel/mempool_options.h
CHANGED
|
@@ -13,18 +13,35 @@
|
|
| 13 |
#include <cstdint>
|
| 14 |
#include <optional>
|
| 15 |
|
|
|
|
|
|
|
| 16 |
class ValidationSignals;
|
| 17 |
|
|
|
|
|
|
|
|
|
|
| 18 |
/** Default for -maxmempool, maximum megabytes of mempool memory usage */
|
| 19 |
static constexpr unsigned int DEFAULT_MAX_MEMPOOL_SIZE_MB{300};
|
| 20 |
/** Default for -maxmempool when blocksonly is set */
|
| 21 |
static constexpr unsigned int DEFAULT_BLOCKSONLY_MAX_MEMPOOL_SIZE_MB{5};
|
| 22 |
/** Default for -mempoolexpiry, expiration time for mempool transactions in hours */
|
| 23 |
static constexpr unsigned int DEFAULT_MEMPOOL_EXPIRY_HOURS{336};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
/** Whether to fall back to legacy V1 serialization when writing mempool.dat */
|
| 25 |
static constexpr bool DEFAULT_PERSIST_V1_DAT{false};
|
|
|
|
|
|
|
| 26 |
/** Default for -acceptnonstdtxn */
|
| 27 |
static constexpr bool DEFAULT_ACCEPT_NON_STD_TXN{false};
|
|
|
|
|
|
|
| 28 |
|
| 29 |
namespace kernel {
|
| 30 |
/**
|
|
@@ -35,14 +52,25 @@ namespace kernel {
|
|
| 35 |
* Most of the time, this struct should be referenced as CTxMemPool::Options.
|
| 36 |
*/
|
| 37 |
struct MemPoolOptions {
|
|
|
|
|
|
|
|
|
|
| 38 |
/* The ratio used to determine how often sanity checks will run. */
|
| 39 |
int check_ratio{0};
|
| 40 |
int64_t max_size_bytes{DEFAULT_MAX_MEMPOOL_SIZE_MB * 1'000'000};
|
| 41 |
std::chrono::seconds expiry{std::chrono::hours{DEFAULT_MEMPOOL_EXPIRY_HOURS}};
|
| 42 |
-
CFeeRate incremental_relay_feerate{DEFAULT_INCREMENTAL_RELAY_FEE};
|
|
|
|
|
|
|
| 43 |
/** A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) */
|
| 44 |
CFeeRate min_relay_feerate{DEFAULT_MIN_RELAY_TX_FEE};
|
| 45 |
CFeeRate dust_relay_feerate{DUST_RELAY_TX_FEE};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
/**
|
| 47 |
* A data carrying output is an unspendable output containing data. The script
|
| 48 |
* type is designated as TxoutType::NULL_DATA.
|
|
@@ -51,8 +79,22 @@ struct MemPoolOptions {
|
|
| 51 |
* If nullopt, any size is nonstandard.
|
| 52 |
*/
|
| 53 |
std::optional<unsigned> max_datacarrier_bytes{DEFAULT_ACCEPT_DATACARRIER ? std::optional{MAX_OP_RETURN_RELAY} : std::nullopt};
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
bool permit_bare_multisig{DEFAULT_PERMIT_BAREMULTISIG};
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
bool require_standard{true};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
bool persist_v1_dat{DEFAULT_PERSIST_V1_DAT};
|
| 57 |
MemPoolLimits limits{};
|
| 58 |
|
|
|
|
| 13 |
#include <cstdint>
|
| 14 |
#include <optional>
|
| 15 |
|
| 16 |
+
class CBlockPolicyEstimator;
|
| 17 |
+
class CScheduler;
|
| 18 |
class ValidationSignals;
|
| 19 |
|
| 20 |
+
enum class RBFPolicy { Never, OptIn, Always };
|
| 21 |
+
enum class TRUCPolicy { Reject, Accept, Enforce };
|
| 22 |
+
|
| 23 |
/** Default for -maxmempool, maximum megabytes of mempool memory usage */
|
| 24 |
static constexpr unsigned int DEFAULT_MAX_MEMPOOL_SIZE_MB{300};
|
| 25 |
/** Default for -maxmempool when blocksonly is set */
|
| 26 |
static constexpr unsigned int DEFAULT_BLOCKSONLY_MAX_MEMPOOL_SIZE_MB{5};
|
| 27 |
/** Default for -mempoolexpiry, expiration time for mempool transactions in hours */
|
| 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};
|
| 37 |
/** Whether to fall back to legacy V1 serialization when writing mempool.dat */
|
| 38 |
static constexpr bool DEFAULT_PERSIST_V1_DAT{false};
|
| 39 |
+
/** Default for -acceptnonstddatacarrier */
|
| 40 |
+
static constexpr bool DEFAULT_ACCEPT_NON_STD_DATACARRIER{false};
|
| 41 |
/** Default for -acceptnonstdtxn */
|
| 42 |
static constexpr bool DEFAULT_ACCEPT_NON_STD_TXN{false};
|
| 43 |
+
/** Default for -acceptunknownwitness */
|
| 44 |
+
static constexpr bool DEFAULT_ACCEPTUNKNOWNWITNESS{true};
|
| 45 |
|
| 46 |
namespace kernel {
|
| 47 |
/**
|
|
|
|
| 52 |
* Most of the time, this struct should be referenced as CTxMemPool::Options.
|
| 53 |
*/
|
| 54 |
struct MemPoolOptions {
|
| 55 |
+
/* Used to estimate appropriate transaction fees. */
|
| 56 |
+
CBlockPolicyEstimator* estimator{nullptr};
|
| 57 |
+
CScheduler* scheduler{nullptr};
|
| 58 |
/* The ratio used to determine how often sanity checks will run. */
|
| 59 |
int check_ratio{0};
|
| 60 |
int64_t max_size_bytes{DEFAULT_MAX_MEMPOOL_SIZE_MB * 1'000'000};
|
| 61 |
std::chrono::seconds expiry{std::chrono::hours{DEFAULT_MEMPOOL_EXPIRY_HOURS}};
|
| 62 |
+
uint64_t minrelaycoinblocks{DEFAULT_MINRELAYCOINBLOCKS};
|
| 63 |
+
int minrelaymaturity{DEFAULT_MINRELAYMATURITY};
|
| 64 |
+
CFeeRate incremental_relay_feerate{CORE_INCREMENTAL_RELAY_FEE};
|
| 65 |
/** A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) */
|
| 66 |
CFeeRate min_relay_feerate{DEFAULT_MIN_RELAY_TX_FEE};
|
| 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};
|
| 74 |
/**
|
| 75 |
* A data carrying output is an unspendable output containing data. The script
|
| 76 |
* type is designated as TxoutType::NULL_DATA.
|
|
|
|
| 79 |
* If nullopt, any size is nonstandard.
|
| 80 |
*/
|
| 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};
|
| 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};
|
| 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};
|
| 98 |
bool persist_v1_dat{DEFAULT_PERSIST_V1_DAT};
|
| 99 |
MemPoolLimits limits{};
|
| 100 |
|