Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 3: [PATCH 03/68] feat(policy): preserve Roots relay and network controls on Core 30.3

src/validation.h

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

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