Skip to content

Commit c76bfff

Browse files
committed
Merge #7440: [0.12] Rename permitrbf to mempoolreplacement and provide minimal string-list forward compatibility
af9f564 release-notes: Update for replacebyfee->mempoolreplacement rename (Luke Dashjr) 4ad418b Rename replacebyfee=opt-in to mempoolreplacement=fee (Luke Dashjr) b2287a7 release-notes: Update for permitrbf->replacebyfee rename (Luke Dashjr) 5f456a6 Simplify check for replacebyfee=opt-in (Luke Dashjr) e8d19ab Accept replacebyfee=opt-in for turning on opt-in RBF (Luke Dashjr) 1205f87 Rename permitrbf to replacebyfee (Luke Dashjr)
2 parents 86755bc + af9f564 commit c76bfff

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

doc/release-notes.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,14 @@ accepted when it pays sufficient fee, as described in [BIP 125]
144144
(https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki).
145145

146146
Transaction replacement can be disabled with a new command line option,
147-
`-permitrbf=false`. Transactions signaling replacement under BIP125 will still
148-
be allowed into the mempool in this configuration, but replacements will be
149-
rejected. This option is intended for miners who want to continue the
147+
`-mempoolreplacement=0`. Transactions signaling replacement under BIP125 will
148+
still be allowed into the mempool in this configuration, but replacements will
149+
be rejected. This option is intended for miners who want to continue the
150150
transaction selection behavior of previous releases.
151151

152-
The `-permitrbf` option is *not recommended* for wallet users seeking to avoid
153-
receipt of unconfirmed opt-in transactions, because this option does not
154-
prevent transactions which are replaceable under BIP 125 from being accepted
152+
The `-mempoolreplacement` option is *not recommended* for wallet users seeking
153+
to avoid receipt of unconfirmed opt-in transactions, because this option does
154+
not prevent transactions which are replaceable under BIP 125 from being accepted
155155
(only subsequent replacements, which other nodes on the network that implement
156156
BIP 125 are likely to relay and mine). Wallet users wishing to detect whether
157157
a transaction is subject to replacement under BIP 125 should instead use the

src/init.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
#include <signal.h>
4848
#endif
4949

50+
#include <boost/algorithm/string/classification.hpp>
5051
#include <boost/algorithm/string/predicate.hpp>
5152
#include <boost/algorithm/string/replace.hpp>
53+
#include <boost/algorithm/string/split.hpp>
5254
#include <boost/bind.hpp>
5355
#include <boost/filesystem.hpp>
5456
#include <boost/function.hpp>
@@ -367,7 +369,6 @@ std::string HelpMessage(HelpMessageMode mode)
367369
strUsage += HelpMessageOpt("-onion=<ip:port>", strprintf(_("Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: %s)"), "-proxy"));
368370
strUsage += HelpMessageOpt("-onlynet=<net>", _("Only connect to nodes in network <net> (ipv4, ipv6 or onion)"));
369371
strUsage += HelpMessageOpt("-permitbaremultisig", strprintf(_("Relay non-P2SH multisig (default: %u)"), DEFAULT_PERMIT_BAREMULTISIG));
370-
strUsage += HelpMessageOpt("-permitrbf", strprintf(_("Permit transaction replacement (default: %u)"), DEFAULT_PERMIT_REPLACEMENT));
371372
strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with bloom filters (default: %u)"), 1));
372373
if (showDebug)
373374
strUsage += HelpMessageOpt("-enforcenodebloom", strprintf("Enforce minimum protocol version to limit use of bloom filters (default: %u)", 0));
@@ -488,6 +489,7 @@ std::string HelpMessage(HelpMessageMode mode)
488489
strUsage += HelpMessageOpt("-bytespersigop", strprintf(_("Minimum bytes per sigop in transactions we relay and mine (default: %u)"), DEFAULT_BYTES_PER_SIGOP));
489490
strUsage += HelpMessageOpt("-datacarrier", strprintf(_("Relay and mine data carrier transactions (default: %u)"), DEFAULT_ACCEPT_DATACARRIER));
490491
strUsage += HelpMessageOpt("-datacarriersize", strprintf(_("Maximum size of data in data carrier transactions we relay and mine (default: %u)"), MAX_OP_RETURN_RELAY));
492+
strUsage += HelpMessageOpt("-mempoolreplacement", strprintf(_("Enable transaction replacement in the memory pool (default: %u)"), DEFAULT_ENABLE_REPLACEMENT));
491493

492494
strUsage += HelpMessageGroup(_("Block creation options:"));
493495
strUsage += HelpMessageOpt("-blockminsize=<n>", strprintf(_("Set minimum block size in bytes (default: %u)"), DEFAULT_BLOCK_MIN_SIZE));
@@ -1026,7 +1028,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
10261028
if (GetBoolArg("-peerbloomfilters", true))
10271029
nLocalServices |= NODE_BLOOM;
10281030

1029-
fPermitReplacement = GetBoolArg("-permitrbf", DEFAULT_PERMIT_REPLACEMENT);
1031+
fEnableReplacement = GetBoolArg("-mempoolreplacement", DEFAULT_ENABLE_REPLACEMENT);
1032+
if ((!fEnableReplacement) && mapArgs.count("-mempoolreplacement")) {
1033+
// Minimal effort at forwards compatibility
1034+
std::string strReplacementModeList = GetArg("-mempoolreplacement", ""); // default is impossible
1035+
std::vector<std::string> vstrReplacementModes;
1036+
boost::split(vstrReplacementModes, strReplacementModeList, boost::is_any_of(","));
1037+
fEnableReplacement = (std::find(vstrReplacementModes.begin(), vstrReplacementModes.end(), "fee") != vstrReplacementModes.end());
1038+
}
10301039

10311040
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
10321041

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED;
7575
size_t nCoinCacheUsage = 5000 * 300;
7676
uint64_t nPruneTarget = 0;
7777
bool fAlerts = DEFAULT_ALERTS;
78-
bool fPermitReplacement = DEFAULT_PERMIT_REPLACEMENT;
78+
bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT;
7979

8080
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying, mining and transaction creation) */
8181
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
@@ -866,7 +866,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
866866
// unconfirmed ancestors anyway; doing otherwise is hopelessly
867867
// insecure.
868868
bool fReplacementOptOut = true;
869-
if (fPermitReplacement)
869+
if (fEnableReplacement)
870870
{
871871
BOOST_FOREACH(const CTxIn &txin, ptxConflicting->vin)
872872
{

src/main.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ static const bool DEFAULT_TXINDEX = false;
108108
static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100;
109109

110110
static const bool DEFAULT_TESTSAFEMODE = false;
111-
/** Default for -permitrbf */
112-
static const bool DEFAULT_PERMIT_REPLACEMENT = true;
111+
/** Default for -mempoolreplacement */
112+
static const bool DEFAULT_ENABLE_REPLACEMENT = true;
113113

114114
/** Maximum number of headers to announce when relaying blocks with headers message.*/
115115
static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8;
@@ -141,7 +141,7 @@ extern bool fCheckpointsEnabled;
141141
extern size_t nCoinCacheUsage;
142142
extern CFeeRate minRelayTxFee;
143143
extern bool fAlerts;
144-
extern bool fPermitReplacement;
144+
extern bool fEnableReplacement;
145145

146146
/** Best header we've seen so far (used for getheaders queries' starting points). */
147147
extern CBlockIndex *pindexBestHeader;

0 commit comments

Comments
 (0)