@@ -13,7 +13,7 @@ RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool)
13
13
{
14
14
AssertLockHeld (pool.cs );
15
15
16
- CTxMemPool::setEntries setAncestors ;
16
+ CTxMemPool::setEntries ancestors ;
17
17
18
18
// First check the transaction itself.
19
19
if (SignalsOptInRBF (tx)) {
@@ -31,9 +31,9 @@ RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool)
31
31
uint64_t noLimit = std::numeric_limits<uint64_t >::max ();
32
32
std::string dummy;
33
33
CTxMemPoolEntry entry = *pool.mapTx .find (tx.GetHash ());
34
- pool.CalculateMemPoolAncestors (entry, setAncestors , noLimit, noLimit, noLimit, noLimit, dummy, false );
34
+ pool.CalculateMemPoolAncestors (entry, ancestors , noLimit, noLimit, noLimit, noLimit, dummy, false );
35
35
36
- for (CTxMemPool::txiter it : setAncestors ) {
36
+ for (CTxMemPool::txiter it : ancestors ) {
37
37
if (SignalsOptInRBF (it->GetTx ())) {
38
38
return RBFTransactionState::REPLACEABLE_BIP125;
39
39
}
@@ -48,43 +48,43 @@ RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx)
48
48
}
49
49
50
50
std::optional<std::string> GetEntriesForConflicts (const CTransaction& tx,
51
- CTxMemPool& m_pool ,
52
- const CTxMemPool::setEntries& setIterConflicting ,
53
- CTxMemPool::setEntries& allConflicting )
51
+ CTxMemPool& pool ,
52
+ const CTxMemPool::setEntries& iters_conflicting ,
53
+ CTxMemPool::setEntries& all_conflicts )
54
54
{
55
- AssertLockHeld (m_pool .cs );
56
- const uint256 hash = tx.GetHash ();
55
+ AssertLockHeld (pool .cs );
56
+ const uint256 txid = tx.GetHash ();
57
57
uint64_t nConflictingCount = 0 ;
58
- for (const auto & mi : setIterConflicting ) {
58
+ for (const auto & mi : iters_conflicting ) {
59
59
nConflictingCount += mi->GetCountWithDescendants ();
60
60
// This potentially overestimates the number of actual descendants
61
61
// but we just want to be conservative to avoid doing too much
62
62
// work.
63
63
if (nConflictingCount > MAX_BIP125_REPLACEMENT_CANDIDATES) {
64
64
return strprintf (" rejecting replacement %s; too many potential replacements (%d > %d)\n " ,
65
- hash .ToString (),
65
+ txid .ToString (),
66
66
nConflictingCount,
67
67
MAX_BIP125_REPLACEMENT_CANDIDATES);
68
68
}
69
69
}
70
70
// If not too many to replace, then calculate the set of
71
71
// transactions that would have to be evicted
72
- for (CTxMemPool::txiter it : setIterConflicting ) {
73
- m_pool .CalculateDescendants (it, allConflicting );
72
+ for (CTxMemPool::txiter it : iters_conflicting ) {
73
+ pool .CalculateDescendants (it, all_conflicts );
74
74
}
75
75
return std::nullopt;
76
76
}
77
77
78
78
std::optional<std::string> HasNoNewUnconfirmed (const CTransaction& tx,
79
- const CTxMemPool& m_pool ,
80
- const CTxMemPool::setEntries& setIterConflicting )
79
+ const CTxMemPool& pool ,
80
+ const CTxMemPool::setEntries& iters_conflicting )
81
81
{
82
- AssertLockHeld (m_pool .cs );
83
- std::set<uint256> setConflictsParents ;
84
- for (const auto & mi : setIterConflicting ) {
82
+ AssertLockHeld (pool .cs );
83
+ std::set<uint256> parents_of_conflicts ;
84
+ for (const auto & mi : iters_conflicting ) {
85
85
for (const CTxIn &txin : mi->GetTx ().vin )
86
86
{
87
- setConflictsParents .insert (txin.prevout .hash );
87
+ parents_of_conflicts .insert (txin.prevout .hash );
88
88
}
89
89
}
90
90
@@ -99,12 +99,12 @@ std::optional<std::string> HasNoNewUnconfirmed(const CTransaction& tx,
99
99
// this may break the CalculateMempoolAncestors RBF relaxation,
100
100
// above. See the comment above the first CalculateMempoolAncestors
101
101
// call for more info.
102
- if (!setConflictsParents .count (tx.vin [j].prevout .hash ))
102
+ if (!parents_of_conflicts .count (tx.vin [j].prevout .hash ))
103
103
{
104
104
// Rather than check the UTXO set - potentially expensive -
105
105
// it's cheaper to just check if the new input refers to a
106
106
// tx that's in the mempool.
107
- if (m_pool .exists (tx.vin [j].prevout .hash )) {
107
+ if (pool .exists (tx.vin [j].prevout .hash )) {
108
108
return strprintf (" replacement %s adds unconfirmed input, idx %d" ,
109
109
tx.GetHash ().ToString (), j);
110
110
}
@@ -113,14 +113,14 @@ std::optional<std::string> HasNoNewUnconfirmed(const CTransaction& tx,
113
113
return std::nullopt;
114
114
}
115
115
116
- std::optional<std::string> EntriesAndTxidsDisjoint (const CTxMemPool::setEntries& setAncestors ,
117
- const std::set<uint256>& setConflicts ,
116
+ std::optional<std::string> EntriesAndTxidsDisjoint (const CTxMemPool::setEntries& ancestors ,
117
+ const std::set<uint256>& direct_conflicts ,
118
118
const uint256& txid)
119
119
{
120
- for (CTxMemPool::txiter ancestorIt : setAncestors )
120
+ for (CTxMemPool::txiter ancestorIt : ancestors )
121
121
{
122
122
const uint256 &hashAncestor = ancestorIt->GetTx ().GetHash ();
123
- if (setConflicts .count (hashAncestor))
123
+ if (direct_conflicts .count (hashAncestor))
124
124
{
125
125
return strprintf (" %s spends conflicting transaction %s" ,
126
126
txid.ToString (),
@@ -130,11 +130,11 @@ std::optional<std::string> EntriesAndTxidsDisjoint(const CTxMemPool::setEntries&
130
130
return std::nullopt;
131
131
}
132
132
133
- std::optional<std::string> PaysMoreThanConflicts (const CTxMemPool::setEntries& setIterConflicting ,
134
- CFeeRate newFeeRate ,
135
- const uint256& hash )
133
+ std::optional<std::string> PaysMoreThanConflicts (const CTxMemPool::setEntries& iters_conflicting ,
134
+ CFeeRate replacement_feerate ,
135
+ const uint256& txid )
136
136
{
137
- for (const auto & mi : setIterConflicting ) {
137
+ for (const auto & mi : iters_conflicting ) {
138
138
// Don't allow the replacement to reduce the feerate of the
139
139
// mempool.
140
140
//
@@ -149,41 +149,41 @@ std::optional<std::string> PaysMoreThanConflicts(const CTxMemPool::setEntries& s
149
149
// mean high feerate children are ignored when deciding whether
150
150
// or not to replace, we do require the replacement to pay more
151
151
// overall fees too, mitigating most cases.
152
- CFeeRate oldFeeRate (mi->GetModifiedFee (), mi->GetTxSize ());
153
- if (newFeeRate <= oldFeeRate )
152
+ CFeeRate original_feerate (mi->GetModifiedFee (), mi->GetTxSize ());
153
+ if (replacement_feerate <= original_feerate )
154
154
{
155
155
return strprintf (" rejecting replacement %s; new feerate %s <= old feerate %s" ,
156
- hash .ToString (),
157
- newFeeRate .ToString (),
158
- oldFeeRate .ToString ());
156
+ txid .ToString (),
157
+ replacement_feerate .ToString (),
158
+ original_feerate .ToString ());
159
159
}
160
160
}
161
161
return std::nullopt;
162
162
}
163
163
164
- std::optional<std::string> PaysForRBF (CAmount nConflictingFees ,
165
- CAmount nModifiedFees ,
166
- size_t nSize ,
167
- const uint256& hash )
164
+ std::optional<std::string> PaysForRBF (CAmount original_fees ,
165
+ CAmount replacement_fees ,
166
+ size_t replacement_vsize ,
167
+ const uint256& txid )
168
168
{
169
169
// The replacement must pay greater fees than the transactions it
170
170
// replaces - if we did the bandwidth used by those conflicting
171
171
// transactions would not be paid for.
172
- if (nModifiedFees < nConflictingFees )
172
+ if (replacement_fees < original_fees )
173
173
{
174
174
return strprintf (" rejecting replacement %s, less fees than conflicting txs; %s < %s" ,
175
- hash .ToString (), FormatMoney (nModifiedFees ), FormatMoney (nConflictingFees ));
175
+ txid .ToString (), FormatMoney (replacement_fees ), FormatMoney (original_fees ));
176
176
}
177
177
178
178
// Finally in addition to paying more fees than the conflicts the
179
179
// new transaction must pay for its own bandwidth.
180
- CAmount nDeltaFees = nModifiedFees - nConflictingFees ;
181
- if (nDeltaFees < ::incrementalRelayFee.GetFee (nSize ))
180
+ CAmount additional_fees = replacement_fees - original_fees ;
181
+ if (additional_fees < ::incrementalRelayFee.GetFee (replacement_vsize ))
182
182
{
183
183
return strprintf (" rejecting replacement %s, not enough additional fees to relay; %s < %s" ,
184
- hash .ToString (),
185
- FormatMoney (nDeltaFees ),
186
- FormatMoney (::incrementalRelayFee.GetFee (nSize )));
184
+ txid .ToString (),
185
+ FormatMoney (additional_fees ),
186
+ FormatMoney (::incrementalRelayFee.GetFee (replacement_vsize )));
187
187
}
188
188
return std::nullopt;
189
189
}
0 commit comments