Browse Source

Merge #7431: Rename permitrbf to mempoolreplacement and provide minimal string-list forward compatibility (needs 0.12 backport)

b922fbe Rename replacebyfee=opt-in to mempoolreplacement=fee (Luke Dashjr)
3b66e54 Simplify check for replacebyfee=opt-in (Luke Dashjr)
d65dee9 Accept replacebyfee=opt-in for turning on opt-in RBF (Luke Dashjr)
77b55a0 Rename permitrbf to replacebyfee (Luke Dashjr)
0.13
Wladimir J. van der Laan 9 years ago
parent
commit
5fd95b4490
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 14
      src/init.cpp
  2. 4
      src/main.cpp
  3. 6
      src/main.h

14
src/init.cpp

@ -47,8 +47,10 @@
#include <signal.h> #include <signal.h>
#endif #endif
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/function.hpp> #include <boost/function.hpp>
@ -367,7 +369,6 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-onion=<ip:port>", strprintf(_("Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: %s)"), "-proxy")); strUsage += HelpMessageOpt("-onion=<ip:port>", strprintf(_("Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: %s)"), "-proxy"));
strUsage += HelpMessageOpt("-onlynet=<net>", _("Only connect to nodes in network <net> (ipv4, ipv6 or onion)")); strUsage += HelpMessageOpt("-onlynet=<net>", _("Only connect to nodes in network <net> (ipv4, ipv6 or onion)"));
strUsage += HelpMessageOpt("-permitbaremultisig", strprintf(_("Relay non-P2SH multisig (default: %u)"), DEFAULT_PERMIT_BAREMULTISIG)); strUsage += HelpMessageOpt("-permitbaremultisig", strprintf(_("Relay non-P2SH multisig (default: %u)"), DEFAULT_PERMIT_BAREMULTISIG));
strUsage += HelpMessageOpt("-permitrbf", strprintf(_("Permit transaction replacements in the memory pool (default: %u)"), DEFAULT_PERMIT_REPLACEMENT));
strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with bloom filters (default: %u)"), 1)); strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with bloom filters (default: %u)"), 1));
if (showDebug) if (showDebug)
strUsage += HelpMessageOpt("-enforcenodebloom", strprintf("Enforce minimum protocol version to limit use of bloom filters (default: %u)", 0)); strUsage += HelpMessageOpt("-enforcenodebloom", strprintf("Enforce minimum protocol version to limit use of bloom filters (default: %u)", 0));
@ -489,6 +490,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-bytespersigop", strprintf(_("Minimum bytes per sigop in transactions we relay and mine (default: %u)"), DEFAULT_BYTES_PER_SIGOP)); strUsage += HelpMessageOpt("-bytespersigop", strprintf(_("Minimum bytes per sigop in transactions we relay and mine (default: %u)"), DEFAULT_BYTES_PER_SIGOP));
strUsage += HelpMessageOpt("-datacarrier", strprintf(_("Relay and mine data carrier transactions (default: %u)"), DEFAULT_ACCEPT_DATACARRIER)); strUsage += HelpMessageOpt("-datacarrier", strprintf(_("Relay and mine data carrier transactions (default: %u)"), DEFAULT_ACCEPT_DATACARRIER));
strUsage += HelpMessageOpt("-datacarriersize", strprintf(_("Maximum size of data in data carrier transactions we relay and mine (default: %u)"), MAX_OP_RETURN_RELAY)); strUsage += HelpMessageOpt("-datacarriersize", strprintf(_("Maximum size of data in data carrier transactions we relay and mine (default: %u)"), MAX_OP_RETURN_RELAY));
strUsage += HelpMessageOpt("-mempoolreplacement", strprintf(_("Enable transaction replacement in the memory pool (default: %u)"), DEFAULT_ENABLE_REPLACEMENT));
strUsage += HelpMessageGroup(_("Block creation options:")); strUsage += HelpMessageGroup(_("Block creation options:"));
strUsage += HelpMessageOpt("-blockminsize=<n>", strprintf(_("Set minimum block size in bytes (default: %u)"), DEFAULT_BLOCK_MIN_SIZE)); strUsage += HelpMessageOpt("-blockminsize=<n>", strprintf(_("Set minimum block size in bytes (default: %u)"), DEFAULT_BLOCK_MIN_SIZE));
@ -1040,7 +1042,15 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
nLocalServices |= NODE_BLOOM; nLocalServices |= NODE_BLOOM;
nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE); nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
fPermitReplacement = GetBoolArg("-permitrbf", DEFAULT_PERMIT_REPLACEMENT);
fEnableReplacement = GetBoolArg("-mempoolreplacement", DEFAULT_ENABLE_REPLACEMENT);
if ((!fEnableReplacement) && mapArgs.count("-mempoolreplacement")) {
// Minimal effort at forwards compatibility
std::string strReplacementModeList = GetArg("-mempoolreplacement", ""); // default is impossible
std::vector<std::string> vstrReplacementModes;
boost::split(vstrReplacementModes, strReplacementModeList, boost::is_any_of(","));
fEnableReplacement = (std::find(vstrReplacementModes.begin(), vstrReplacementModes.end(), "fee") != vstrReplacementModes.end());
}
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log // ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log

4
src/main.cpp

@ -76,7 +76,7 @@ size_t nCoinCacheUsage = 5000 * 300;
uint64_t nPruneTarget = 0; uint64_t nPruneTarget = 0;
bool fAlerts = DEFAULT_ALERTS; bool fAlerts = DEFAULT_ALERTS;
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE; int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
bool fPermitReplacement = DEFAULT_PERMIT_REPLACEMENT; bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT;
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE); CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE; CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE;
@ -867,7 +867,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
// unconfirmed ancestors anyway; doing otherwise is hopelessly // unconfirmed ancestors anyway; doing otherwise is hopelessly
// insecure. // insecure.
bool fReplacementOptOut = true; bool fReplacementOptOut = true;
if (fPermitReplacement) if (fEnableReplacement)
{ {
BOOST_FOREACH(const CTxIn &txin, ptxConflicting->vin) BOOST_FOREACH(const CTxIn &txin, ptxConflicting->vin)
{ {

6
src/main.h

@ -115,8 +115,8 @@ static const bool DEFAULT_TXINDEX = false;
static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100; static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100;
static const bool DEFAULT_TESTSAFEMODE = false; static const bool DEFAULT_TESTSAFEMODE = false;
/** Default for -permitrbf */ /** Default for -mempoolreplacement */
static const bool DEFAULT_PERMIT_REPLACEMENT = true; static const bool DEFAULT_ENABLE_REPLACEMENT = true;
/** Maximum number of headers to announce when relaying blocks with headers message.*/ /** Maximum number of headers to announce when relaying blocks with headers message.*/
static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8; static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8;
@ -153,7 +153,7 @@ extern CAmount maxTxFee;
extern bool fAlerts; extern bool fAlerts;
/** If the tip is older than this (in seconds), the node is considered to be in initial block download. */ /** If the tip is older than this (in seconds), the node is considered to be in initial block download. */
extern int64_t nMaxTipAge; extern int64_t nMaxTipAge;
extern bool fPermitReplacement; extern bool fEnableReplacement;
/** Best header we've seen so far (used for getheaders queries' starting points). */ /** Best header we've seen so far (used for getheaders queries' starting points). */
extern CBlockIndex *pindexBestHeader; extern CBlockIndex *pindexBestHeader;

Loading…
Cancel
Save