Skip to content

Commit 8053e5c

Browse files
committed
Remove -mempoolreplacement to prevent needless block prop slowness.
At this point there is no reasonable excuse to disable opt-in RBF, and, unlike when this option was added, there are now significant issues created when disabling it (in the form of compact block reconstruction failures). Further, it breaks a lot of modern wallet behavior.
1 parent 5d2ccf0 commit 8053e5c

File tree

6 files changed

+5
-41
lines changed

6 files changed

+5
-41
lines changed

doc/man/bitcoin-qt.1

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,6 @@ Relay and mine data carrier transactions (default: 1)
488488
Maximum size of data in data carrier transactions we relay and mine
489489
(default: 83)
490490
.HP
491-
\fB\-mempoolreplacement\fR
492-
.IP
493-
Enable transaction replacement in the memory pool (default: 1)
494491
.HP
495492
\fB\-minrelaytxfee=\fR<amt>
496493
.IP

doc/man/bitcoind.1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,6 @@ Relay and mine data carrier transactions (default: 1)
488488
Maximum size of data in data carrier transactions we relay and mine
489489
(default: 83)
490490
.HP
491-
\fB\-mempoolreplacement\fR
492-
.IP
493-
Enable transaction replacement in the memory pool (default: 1)
494-
.HP
495491
\fB\-minrelaytxfee=\fR<amt>
496492
.IP
497493
Fees (in BTC/kB) smaller than this are considered zero fee for relaying,

src/init.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,6 @@ void SetupServerArgs()
524524
gArgs.AddArg("-bytespersigop", strprintf("Equivalent bytes per sigop in transactions for relay and mining (default: %u)", DEFAULT_BYTES_PER_SIGOP), false, OptionsCategory::NODE_RELAY);
525525
gArgs.AddArg("-datacarrier", strprintf("Relay and mine data carrier transactions (default: %u)", DEFAULT_ACCEPT_DATACARRIER), false, OptionsCategory::NODE_RELAY);
526526
gArgs.AddArg("-datacarriersize", strprintf("Maximum size of data in data carrier transactions we relay and mine (default: %u)", MAX_OP_RETURN_RELAY), false, OptionsCategory::NODE_RELAY);
527-
gArgs.AddArg("-mempoolreplacement", strprintf("Enable transaction replacement in the memory pool (default: %u)", DEFAULT_ENABLE_REPLACEMENT), false, OptionsCategory::NODE_RELAY);
528527
gArgs.AddArg("-minrelaytxfee=<amt>", strprintf("Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)",
529528
CURRENCY_UNIT, FormatMoney(DEFAULT_MIN_RELAY_TX_FEE)), false, OptionsCategory::NODE_RELAY);
530529
gArgs.AddArg("-whitelistforcerelay", strprintf("Force relay of transactions from whitelisted peers even if the transactions were already in the mempool or violate local relay policy (default: %d)", DEFAULT_WHITELISTFORCERELAY), false, OptionsCategory::NODE_RELAY);
@@ -1176,15 +1175,6 @@ bool AppInitParameterInteraction()
11761175

11771176
nMaxTipAge = gArgs.GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
11781177

1179-
fEnableReplacement = gArgs.GetBoolArg("-mempoolreplacement", DEFAULT_ENABLE_REPLACEMENT);
1180-
if ((!fEnableReplacement) && gArgs.IsArgSet("-mempoolreplacement")) {
1181-
// Minimal effort at forwards compatibility
1182-
std::string strReplacementModeList = gArgs.GetArg("-mempoolreplacement", ""); // default is impossible
1183-
std::vector<std::string> vstrReplacementModes;
1184-
boost::split(vstrReplacementModes, strReplacementModeList, boost::is_any_of(","));
1185-
fEnableReplacement = (std::find(vstrReplacementModes.begin(), vstrReplacementModes.end(), "fee") != vstrReplacementModes.end());
1186-
}
1187-
11881178
return true;
11891179
}
11901180

src/validation.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED;
111111
size_t nCoinCacheUsage = 5000 * 300;
112112
uint64_t nPruneTarget = 0;
113113
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
114-
bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT;
115114

116115
uint256 hashAssumeValid;
117116
arith_uint256 nMinimumChainWork;
@@ -486,15 +485,12 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
486485
// unconfirmed ancestors anyway; doing otherwise is hopelessly
487486
// insecure.
488487
bool fReplacementOptOut = true;
489-
if (fEnableReplacement)
488+
for (const CTxIn &_txin : ptxConflicting->vin)
490489
{
491-
for (const CTxIn &_txin : ptxConflicting->vin)
490+
if (_txin.nSequence <= MAX_BIP125_RBF_SEQUENCE)
492491
{
493-
if (_txin.nSequence <= MAX_BIP125_RBF_SEQUENCE)
494-
{
495-
fReplacementOptOut = false;
496-
break;
497-
}
492+
fReplacementOptOut = false;
493+
break;
498494
}
499495
}
500496
if (fReplacementOptOut) {

src/validation.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ static const char* const DEFAULT_BLOCKFILTERINDEX = "0";
116116
static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100;
117117
/** Default for -persistmempool */
118118
static const bool DEFAULT_PERSIST_MEMPOOL = true;
119-
/** Default for -mempoolreplacement */
120-
static const bool DEFAULT_ENABLE_REPLACEMENT = true;
121119
/** Default for using fee filter */
122120
static const bool DEFAULT_FEEFILTER = true;
123121

@@ -160,7 +158,6 @@ extern size_t nCoinCacheUsage;
160158
extern CFeeRate minRelayTxFee;
161159
/** If the tip is older than this (in seconds), the node is considered to be in initial block download. */
162160
extern int64_t nMaxTipAge;
163-
extern bool fEnableReplacement;
164161

165162
/** Block hash whose ancestors we will assume to have valid scripts without checking them. */
166163
extern uint256 hashAssumeValid;

test/functional/feature_rbf.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def make_utxo(node, amount, confirmed=True, scriptPubKey=CScript([1])):
6464

6565
class ReplaceByFeeTest(BitcoinTestFramework):
6666
def set_test_params(self):
67-
self.num_nodes = 2
67+
self.num_nodes = 1
6868
self.extra_args = [
6969
[
7070
"-maxorphantx=1000",
@@ -74,9 +74,6 @@ def set_test_params(self):
7474
"-limitdescendantcount=200",
7575
"-limitdescendantsize=101",
7676
],
77-
[
78-
"-mempoolreplacement=0",
79-
],
8077
]
8178

8279
def skip_test_if_missing_module(self):
@@ -148,16 +145,12 @@ def test_simple_doublespend(self):
148145

149146
# This will raise an exception due to insufficient fee
150147
assert_raises_rpc_error(-26, "insufficient fee", self.nodes[0].sendrawtransaction, tx1b_hex, 0)
151-
# This will raise an exception due to transaction replacement being disabled
152-
assert_raises_rpc_error(-26, "txn-mempool-conflict", self.nodes[1].sendrawtransaction, tx1b_hex, 0)
153148

154149
# Extra 0.1 BTC fee
155150
tx1b = CTransaction()
156151
tx1b.vin = [CTxIn(tx0_outpoint, nSequence=0)]
157152
tx1b.vout = [CTxOut(int(0.9 * COIN), CScript([b'b' * 35]))]
158153
tx1b_hex = txToHex(tx1b)
159-
# Replacement still disabled even with "enough fee"
160-
assert_raises_rpc_error(-26, "txn-mempool-conflict", self.nodes[1].sendrawtransaction, tx1b_hex, 0)
161154
# Works when enabled
162155
tx1b_txid = self.nodes[0].sendrawtransaction(tx1b_hex, 0)
163156

@@ -168,11 +161,6 @@ def test_simple_doublespend(self):
168161

169162
assert_equal(tx1b_hex, self.nodes[0].getrawtransaction(tx1b_txid))
170163

171-
# Second node is running mempoolreplacement=0, will not replace originally-seen txn
172-
mempool = self.nodes[1].getrawmempool()
173-
assert tx1a_txid in mempool
174-
assert tx1b_txid not in mempool
175-
176164
def test_doublespend_chain(self):
177165
"""Doublespend of a long chain"""
178166

0 commit comments

Comments
 (0)