v29.4-roots.3 · Commit 3: [PATCH 03/30] 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. The two line-number columns refer to before and after.
src/validation.h
CHANGED
|
@@ -88,6 +88,13 @@ enum class SynchronizationState {
|
|
|
88
88
|
POST_INIT
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
+
enum SpkReuseModes {
|
|
92
|
+
SRM_ALLOW,
|
|
93
|
+
SRM_REJECT,
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
extern SpkReuseModes SpkReuseMode;
|
|
97
|
+
|
|
91
98
|
/** Documentation for argument 'checklevel'. */
|
|
92
99
|
extern const std::vector<std::string> CHECKLEVEL_DOC;
|
|
93
100
|
|
|
@@ -249,6 +256,11 @@ struct PackageMempoolAcceptResult
|
|
|
249
256
|
: m_tx_results{ {wtxid, result} } {}
|
|
250
257
|
};
|
|
251
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
|
+
|
|
252
264
|
/**
|
|
253
265
|
* Try to add a transaction to the mempool. This is an internal function and is exposed only for testing.
|
|
254
266
|
* Client code should use ChainstateManager::ProcessTransaction()
|
|
@@ -257,15 +269,24 @@ struct PackageMempoolAcceptResult
|
|
|
257
269
|
* @param[in] tx The transaction to submit for mempool acceptance.
|
|
258
270
|
* @param[in] accept_time The timestamp for adding the transaction to the mempool.
|
|
259
271
|
* 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.
|
|
272
|
+
* @param[in] ignore_rejects Set of reject reasons to ignore and bypass, if possible.
|
|
262
273
|
* @param[in] test_accept When true, run validation checks but don't submit to mempool.
|
|
263
274
|
*
|
|
264
275
|
* @returns a MempoolAcceptResult indicating whether the transaction was accepted/rejected with reason.
|
|
265
276
|
*/
|
|
266
277
|
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);
|
|
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
|
+
}
|
|
269
290
|
|
|
270
291
|
/**
|
|
271
292
|
* 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
299
|
* possible for the package to be partially submitted.
|
|
279
300
|
*/
|
|
280
301
|
PackageMempoolAcceptResult ProcessNewPackage(Chainstate& active_chainstate, CTxMemPool& pool,
|
|
281
|
-
const Package& txns, bool test_accept, const std::optional<CFeeRate>& client_maxfeerate)
|
|
302
|
+
const Package& txns, bool test_accept, const std::optional<CFeeRate>& client_maxfeerate, const ignore_rejects_type& ignore_rejects=empty_ignore_rejects)
|
|
282
303
|
EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
|
283
304
|
|
|
284
305
|
/* Mempool validation helper functions */
|