v30.3-roots.1 · Commit 3: [PATCH 03/68] feat(policy): preserve Roots relay and network controls on Core 30.3
src/policy/rbf.cpp
Before: src/policy/rbf.cpp · After: src/policy/rbf.cpp
File metadata
index 210b94915ccb2e851bf00b87b0799b9590481674..06dc3d701358aa86e9208e3133057a026fa46b19 100644
Download original patch · Release notes
Diff rows 1–44 of 44. 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/policy/rbf.cpp
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
#include <consensus/amount.h>
|
|
8
8
|
#include <kernel/mempool_entry.h>
|
|
9
9
|
#include <policy/feerate.h>
|
|
10
|
+
#include <policy/policy.h>
|
|
10
11
|
#include <primitives/transaction.h>
|
|
11
12
|
#include <sync.h>
|
|
12
13
|
#include <tinyformat.h>
|
|
@@ -59,7 +60,8 @@ RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx)
|
|
|
59
60
|
std::optional<std::string> GetEntriesForConflicts(const CTransaction& tx,
|
|
60
61
|
CTxMemPool& pool,
|
|
61
62
|
const CTxMemPool::setEntries& iters_conflicting,
|
|
62
|
-
CTxMemPool::setEntries& all_conflicts)
|
|
63
|
+
CTxMemPool::setEntries& all_conflicts,
|
|
64
|
+
const ignore_rejects_type& ignore_rejects)
|
|
63
65
|
{
|
|
64
66
|
AssertLockHeld(pool.cs);
|
|
65
67
|
uint64_t nConflictingCount = 0;
|
|
@@ -69,7 +71,7 @@ std::optional<std::string> GetEntriesForConflicts(const CTransaction& tx,
|
|
|
69
71
|
// entries from the mempool. This potentially overestimates the number of actual
|
|
70
72
|
// descendants (i.e. if multiple conflicts share a descendant, it will be counted multiple
|
|
71
73
|
// times), but we just want to be conservative to avoid doing too much work.
|
|
72
|
-
if (nConflictingCount > MAX_REPLACEMENT_CANDIDATES) {
|
|
74
|
+
if (nConflictingCount > MAX_REPLACEMENT_CANDIDATES && !ignore_rejects.count("too-many-replacements") && !ignore_rejects.count("too many potential replacements")) {
|
|
73
75
|
return strprintf("rejecting replacement %s; too many potential replacements (%d > %d)",
|
|
74
76
|
tx.GetHash().ToString(),
|
|
75
77
|
nConflictingCount,
|
|
@@ -116,12 +118,17 @@ std::optional<std::string> HasNoNewUnconfirmed(const CTransaction& tx,
|
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
std::optional<std::string> EntriesAndTxidsDisjoint(const CTxMemPool::setEntries& ancestors,
|
|
119
|
-
const std::set<Txid>& direct_conflicts,
|
|
120
|
-
const Txid& txid)
|
|
121
|
+
const std::map<Txid, bool>& direct_conflicts,
|
|
122
|
+
const Txid& txid, bool* const out_violates_policy)
|
|
121
123
|
{
|
|
122
124
|
for (CTxMemPool::txiter ancestorIt : ancestors) {
|
|
123
125
|
const Txid& hashAncestor = ancestorIt->GetTx().GetHash();
|
|
124
|
-
if (direct_conflicts.count(hashAncestor)) {
|
|
126
|
+
const auto& conflictit = direct_conflicts.find(hashAncestor);
|
|
127
|
+
if (conflictit != direct_conflicts.end()) {
|
|
128
|
+
if (!conflictit->second /* mere SPK conflict, NOT invalid */) {
|
|
129
|
+
if (out_violates_policy) *out_violates_policy = true;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
125
132
|
return strprintf("%s spends conflicting transaction %s",
|
|
126
133
|
txid.ToString(),
|
|
127
134
|
hashAncestor.ToString());
|