Skip to content
Bitcoin Roots

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

src/validation.h

Before: src/validation.h · After: src/validation.h

File metadata
index f6cbee28fc55cd5a84b3378b0835ec3527e8a5b1..2d262cd0d1e5dd82fb2bf2a5e6833aa5e1008d56 100644

Download original patch · Release notes

Diff rows 1–60 of 60. 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/validation.h CHANGED
@@ -88,6 +88,13 @@ enum class SynchronizationState {
88
  POST_INIT
89
  };
90
 
 
 
 
 
 
 
 
91
  /** Documentation for argument 'checklevel'. */
92
  extern const std::vector<std::string> CHECKLEVEL_DOC;
93
 
@@ -249,6 +256,11 @@ struct PackageMempoolAcceptResult
249
  : m_tx_results{ {wtxid, result} } {}
250
  };
251
 
 
 
 
 
 
252
  /**
253
  * Try to add a transaction to the mempool. This is an internal function and is exposed only for testing.
254
  * Client code should use ChainstateManager::ProcessTransaction()
@@ -257,15 +269,24 @@ struct PackageMempoolAcceptResult
257
  * @param[in] tx The transaction to submit for mempool acceptance.
258
  * @param[in] accept_time The timestamp for adding the transaction to the mempool.
259
  * It is also used to determine when the entry expires.
260
- * @param[in] bypass_limits When true, don't enforce mempool fee and capacity limits,
261
- * and set entry_sequence to zero.
262
  * @param[in] test_accept When true, run validation checks but don't submit to mempool.
263
  *
264
  * @returns a MempoolAcceptResult indicating whether the transaction was accepted/rejected with reason.
265
  */
266
  MempoolAcceptResult AcceptToMemoryPool(Chainstate& active_chainstate, const CTransactionRef& tx,
267
- int64_t accept_time, bool bypass_limits, bool test_accept)
268
- EXCLUSIVE_LOCKS_REQUIRED(cs_main);
 
 
 
 
 
 
 
 
 
 
269
 
270
  /**
271
  * Validate (and maybe submit) a package to the mempool. See doc/policy/packages.md for full details
@@ -278,7 +299,7 @@ MempoolAcceptResult AcceptToMemoryPool(Chainstate& active_chainstate, const CTra
278
  * possible for the package to be partially submitted.
279
  */
280
  PackageMempoolAcceptResult ProcessNewPackage(Chainstate& active_chainstate, CTxMemPool& pool,
281
- const Package& txns, bool test_accept, const std::optional<CFeeRate>& client_maxfeerate)
282
  EXCLUSIVE_LOCKS_REQUIRED(cs_main);
283
 
284
  /* Mempool validation helper functions */
 
88
  POST_INIT
89
  };
90
 
91
+ enum SpkReuseModes {
92
+ SRM_ALLOW,
93
+ SRM_REJECT,
94
+ };
95
+
96
+ extern SpkReuseModes SpkReuseMode;
97
+
98
  /** Documentation for argument 'checklevel'. */
99
  extern const std::vector<std::string> CHECKLEVEL_DOC;
100
 
 
256
  : m_tx_results{ {wtxid, result} } {}
257
  };
258
 
259
+ static const std::string rejectmsg_lowfee_mempool = "mempool min fee not met";
260
+ static const std::string rejectmsg_lowfee_relay = "min relay fee not met";
261
+ static const std::string rejectmsg_mempoolfull = "mempool full";
262
+ static const std::string rejectmsg_zero_mempool_entry_seq = "zero mempool entry sequence";
263
+
264
  /**
265
  * Try to add a transaction to the mempool. This is an internal function and is exposed only for testing.
266
  * Client code should use ChainstateManager::ProcessTransaction()
 
269
  * @param[in] tx The transaction to submit for mempool acceptance.
270
  * @param[in] accept_time The timestamp for adding the transaction to the mempool.
271
  * It is also used to determine when the entry expires.
272
+ * @param[in] ignore_rejects Set of reject reasons to ignore and bypass, if possible.
 
273
  * @param[in] test_accept When true, run validation checks but don't submit to mempool.
274
  *
275
  * @returns a MempoolAcceptResult indicating whether the transaction was accepted/rejected with reason.
276
  */
277
  MempoolAcceptResult AcceptToMemoryPool(Chainstate& active_chainstate, const CTransactionRef& tx,
278
+ int64_t accept_time, const ignore_rejects_type& ignore_rejects, bool test_accept) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
279
+
280
+ static inline MempoolAcceptResult AcceptToMemoryPool(Chainstate& active_chainstate, const CTransactionRef& tx, int64_t accept_time, bool bypass_limits, bool test_accept) EXCLUSIVE_LOCKS_REQUIRED(cs_main) {
281
+ static const ignore_rejects_type ignore_rejects_legacy{
282
+ rejectmsg_lowfee_mempool,
283
+ rejectmsg_lowfee_relay,
284
+ rejectmsg_mempoolfull,
285
+ rejectmsg_zero_mempool_entry_seq,
286
+ "truc",
287
+ };
288
+ return AcceptToMemoryPool(active_chainstate, tx, accept_time, (bypass_limits ? ignore_rejects_legacy : empty_ignore_rejects), test_accept);
289
+ }
290
 
291
  /**
292
  * Validate (and maybe submit) a package to the mempool. See doc/policy/packages.md for full details
 
299
  * possible for the package to be partially submitted.
300
  */
301
  PackageMempoolAcceptResult ProcessNewPackage(Chainstate& active_chainstate, CTxMemPool& pool,
302
+ const Package& txns, bool test_accept, const std::optional<CFeeRate>& client_maxfeerate, const ignore_rejects_type& ignore_rejects=empty_ignore_rejects)
303
  EXCLUSIVE_LOCKS_REQUIRED(cs_main);
304
 
305
  /* Mempool validation helper functions */