Skip to content

Commit 32024d4

Browse files
committed
scripted-diff: remove mention of BIP125 from non-signaling var names
Our RBF policy is different from the rules specified in BIP125 (refer to doc/policy/mempool-replacements.md instead), and will continue to diverge with package RBF. Keep references to BIP125 sequence number, since that is still useful and correct. -BEGIN VERIFY SCRIPT- ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); } ren m_allow_bip125_replacement m_allow_replacement ren allow_bip125_replacement allow_replacement ren MAX_BIP125_REPLACEMENT_CANDIDATES MAX_REPLACEMENT_CANDIDATES -END VERIFY SCRIPT-
1 parent 4a4289e commit 32024d4

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/policy/rbf.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ std::optional<std::string> GetEntriesForConflicts(const CTransaction& tx,
6565
uint64_t nConflictingCount = 0;
6666
for (const auto& mi : iters_conflicting) {
6767
nConflictingCount += mi->GetCountWithDescendants();
68-
// BIP125 Rule #5: don't consider replacing more than MAX_BIP125_REPLACEMENT_CANDIDATES
68+
// BIP125 Rule #5: don't consider replacing more than MAX_REPLACEMENT_CANDIDATES
6969
// entries from the mempool. This potentially overestimates the number of actual
7070
// descendants (i.e. if multiple conflicts share a descendant, it will be counted multiple
7171
// times), but we just want to be conservative to avoid doing too much work.
72-
if (nConflictingCount > MAX_BIP125_REPLACEMENT_CANDIDATES) {
72+
if (nConflictingCount > MAX_REPLACEMENT_CANDIDATES) {
7373
return strprintf("rejecting replacement %s; too many potential replacements (%d > %d)\n",
7474
txid.ToString(),
7575
nConflictingCount,
76-
MAX_BIP125_REPLACEMENT_CANDIDATES);
76+
MAX_REPLACEMENT_CANDIDATES);
7777
}
7878
}
7979
// Calculate the set of all transactions that would have to be evicted.

src/policy/rbf.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class uint256;
2121

2222
/** Maximum number of transactions that can be replaced by BIP125 RBF (Rule #5). This includes all
2323
* mempool conflicts and their descendants. */
24-
static constexpr uint32_t MAX_BIP125_REPLACEMENT_CANDIDATES{100};
24+
static constexpr uint32_t MAX_REPLACEMENT_CANDIDATES{100};
2525

2626
/** The rbf state of unconfirmed transactions */
2727
enum class RBFTransactionState {
@@ -50,7 +50,7 @@ RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx);
5050
/** Get all descendants of iters_conflicting. Also enforce BIP125 Rule #5, "The number of original
5151
* transactions to be replaced and their descendant transactions which will be evicted from the
5252
* mempool must not exceed a total of 100 transactions." Quit as early as possible. There cannot be
53-
* more than MAX_BIP125_REPLACEMENT_CANDIDATES potential entries.
53+
* more than MAX_REPLACEMENT_CANDIDATES potential entries.
5454
* @param[in] iters_conflicting The set of iterators to mempool entries.
5555
* @param[out] all_conflicts Populated with all the mempool entries that would be replaced,
5656
* which includes descendants of iters_conflicting. Not cleared at

src/validation.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ class MemPoolAccept
450450
/** Whether we allow transactions to replace mempool transactions by BIP125 rules. If false,
451451
* any transaction spending the same inputs as a transaction in the mempool is considered
452452
* a conflict. */
453-
const bool m_allow_bip125_replacement;
453+
const bool m_allow_replacement;
454454
/** When true, the mempool will not be trimmed when individual transactions are submitted in
455455
* Finalize(). Instead, limits should be enforced at the end to ensure the package is not
456456
* partially submitted.
@@ -470,7 +470,7 @@ class MemPoolAccept
470470
/* m_bypass_limits */ bypass_limits,
471471
/* m_coins_to_uncache */ coins_to_uncache,
472472
/* m_test_accept */ test_accept,
473-
/* m_allow_bip125_replacement */ true,
473+
/* m_allow_replacement */ true,
474474
/* m_package_submission */ false,
475475
/* m_package_feerates */ false,
476476
};
@@ -484,7 +484,7 @@ class MemPoolAccept
484484
/* m_bypass_limits */ false,
485485
/* m_coins_to_uncache */ coins_to_uncache,
486486
/* m_test_accept */ true,
487-
/* m_allow_bip125_replacement */ false,
487+
/* m_allow_replacement */ false,
488488
/* m_package_submission */ false, // not submitting to mempool
489489
/* m_package_feerates */ false,
490490
};
@@ -498,7 +498,7 @@ class MemPoolAccept
498498
/* m_bypass_limits */ false,
499499
/* m_coins_to_uncache */ coins_to_uncache,
500500
/* m_test_accept */ false,
501-
/* m_allow_bip125_replacement */ false,
501+
/* m_allow_replacement */ false,
502502
/* m_package_submission */ true,
503503
/* m_package_feerates */ true,
504504
};
@@ -511,7 +511,7 @@ class MemPoolAccept
511511
/* m_bypass_limits */ false,
512512
/* m_coins_to_uncache */ package_args.m_coins_to_uncache,
513513
/* m_test_accept */ package_args.m_test_accept,
514-
/* m_allow_bip125_replacement */ true,
514+
/* m_allow_replacement */ true,
515515
/* m_package_submission */ false,
516516
/* m_package_feerates */ false, // only 1 transaction
517517
};
@@ -525,15 +525,15 @@ class MemPoolAccept
525525
bool bypass_limits,
526526
std::vector<COutPoint>& coins_to_uncache,
527527
bool test_accept,
528-
bool allow_bip125_replacement,
528+
bool allow_replacement,
529529
bool package_submission,
530530
bool package_feerates)
531531
: m_chainparams{chainparams},
532532
m_accept_time{accept_time},
533533
m_bypass_limits{bypass_limits},
534534
m_coins_to_uncache{coins_to_uncache},
535535
m_test_accept{test_accept},
536-
m_allow_bip125_replacement{allow_bip125_replacement},
536+
m_allow_replacement{allow_replacement},
537537
m_package_submission{package_submission},
538538
m_package_feerates{package_feerates}
539539
{
@@ -732,7 +732,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
732732
{
733733
const CTransaction* ptxConflicting = m_pool.GetConflictTx(txin.prevout);
734734
if (ptxConflicting) {
735-
if (!args.m_allow_bip125_replacement) {
735+
if (!args.m_allow_replacement) {
736736
// Transaction conflicts with a mempool tx, but we're not allowing replacements.
737737
return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "bip125-replacement-disallowed");
738738
}
@@ -1225,7 +1225,7 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptMultipleTransactions(const std::
12251225
// package to spend. Since we already checked conflicts in the package and we don't allow
12261226
// replacements, we don't need to track the coins spent. Note that this logic will need to be
12271227
// updated if package replace-by-fee is allowed in the future.
1228-
assert(!args.m_allow_bip125_replacement);
1228+
assert(!args.m_allow_replacement);
12291229
m_viewmempool.PackageAddTransaction(ws.m_ptx);
12301230
}
12311231

0 commit comments

Comments
 (0)