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. The two line-number columns refer to before and after.
src/validation.h
CHANGED
|
@@ -91,6 +91,13 @@ enum class SynchronizationState {
|
|
|
91
91
|
POST_INIT
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
+
enum SpkReuseModes {
|
|
95
|
+
SRM_ALLOW,
|
|
96
|
+
SRM_REJECT,
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
extern SpkReuseModes SpkReuseMode;
|
|
100
|
+
|
|
94
101
|
/** Documentation for argument 'checklevel'. */
|
|
95
102
|
extern const std::vector<std::string> CHECKLEVEL_DOC;
|
|
96
103
|
|
|
@@ -252,6 +259,11 @@ struct PackageMempoolAcceptResult
|
|
|
252
259
|
: m_tx_results{ {wtxid, result} } {}
|
|
253
260
|
};
|
|
254
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
|
+
|
|
255
267
|
/**
|
|
256
268
|
* Try to add a transaction to the mempool. This is an internal function and is exposed only for testing.
|
|
257
269
|
* Client code should use ChainstateManager::ProcessTransaction()
|
|
@@ -260,15 +272,24 @@ struct PackageMempoolAcceptResult
|
|
|
260
272
|
* @param[in] tx The transaction to submit for mempool acceptance.
|
|
261
273
|
* @param[in] accept_time The timestamp for adding the transaction to the mempool.
|
|
262
274
|
* 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.
|
|
275
|
+
* @param[in] ignore_rejects Set of reject reasons to ignore and bypass, if possible.
|
|
265
276
|
* @param[in] test_accept When true, run validation checks but don't submit to mempool.
|
|
266
277
|
*
|
|
267
278
|
* @returns a MempoolAcceptResult indicating whether the transaction was accepted/rejected with reason.
|
|
268
279
|
*/
|
|
269
280
|
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);
|
|
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
|
+
}
|
|
272
293
|
|
|
273
294
|
/**
|
|
274
295
|
* 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
302
|
* possible for the package to be partially submitted.
|
|
282
303
|
*/
|
|
283
304
|
PackageMempoolAcceptResult ProcessNewPackage(Chainstate& active_chainstate, CTxMemPool& pool,
|
|
284
|
-
const Package& txns, bool test_accept, const std::optional<CFeeRate>& client_maxfeerate)
|
|
305
|
+
const Package& txns, bool test_accept, const std::optional<CFeeRate>& client_maxfeerate, const ignore_rejects_type& ignore_rejects=empty_ignore_rejects)
|
|
285
306
|
EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
|
286
307
|
|
|
287
308
|
/* Mempool validation helper functions */
|