Add option -permitrbf
to set transaction replacement policy
Add a configuration option `-permitrbf` to set transaction replacement policy for the mempool. Enabling it will enable (opt-in) RBF, disabling it will refuse all conflicting transactions. Conflicts: src/init.cpp src/main.cpp src/main.h Github-Pull: #7386 Rebased-From: b768108d9c0b83330572711aef1e569543130d5e
This commit is contained in:
parent
e25b158ab8
commit
da83ecd454
@ -366,6 +366,7 @@ 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("-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("-permitrbf", strprintf(_("Permit transaction replacement (default: %u)"), DEFAULT_PERMIT_REPLACEMENT));
|
||||
strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with bloom filters (default: %u)"), 1));
|
||||
if (showDebug)
|
||||
strUsage += HelpMessageOpt("-enforcenodebloom", strprintf("Enforce minimum protocol version to limit use of bloom filters (default: %u)", 0));
|
||||
@ -1007,6 +1008,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
if (GetBoolArg("-peerbloomfilters", true))
|
||||
nLocalServices |= NODE_BLOOM;
|
||||
|
||||
fPermitReplacement = GetBoolArg("-permitrbf", DEFAULT_PERMIT_REPLACEMENT);
|
||||
|
||||
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
|
||||
|
||||
// Initialize elliptic curve code
|
||||
|
12
src/main.cpp
12
src/main.cpp
@ -75,6 +75,7 @@ bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED;
|
||||
size_t nCoinCacheUsage = 5000 * 300;
|
||||
uint64_t nPruneTarget = 0;
|
||||
bool fAlerts = DEFAULT_ALERTS;
|
||||
bool fPermitReplacement = DEFAULT_PERMIT_REPLACEMENT;
|
||||
|
||||
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying, mining and transaction creation) */
|
||||
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
|
||||
@ -865,12 +866,15 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
|
||||
// unconfirmed ancestors anyway; doing otherwise is hopelessly
|
||||
// insecure.
|
||||
bool fReplacementOptOut = true;
|
||||
BOOST_FOREACH(const CTxIn &txin, ptxConflicting->vin)
|
||||
if (fPermitReplacement)
|
||||
{
|
||||
if (txin.nSequence < std::numeric_limits<unsigned int>::max()-1)
|
||||
BOOST_FOREACH(const CTxIn &txin, ptxConflicting->vin)
|
||||
{
|
||||
fReplacementOptOut = false;
|
||||
break;
|
||||
if (txin.nSequence < std::numeric_limits<unsigned int>::max()-1)
|
||||
{
|
||||
fReplacementOptOut = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fReplacementOptOut)
|
||||
|
@ -106,6 +106,8 @@ static const bool DEFAULT_TXINDEX = false;
|
||||
static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100;
|
||||
|
||||
static const bool DEFAULT_TESTSAFEMODE = false;
|
||||
/** Default for -permitrbf */
|
||||
static const bool DEFAULT_PERMIT_REPLACEMENT = true;
|
||||
|
||||
/** Maximum number of headers to announce when relaying blocks with headers message.*/
|
||||
static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8;
|
||||
@ -137,6 +139,7 @@ extern bool fCheckpointsEnabled;
|
||||
extern size_t nCoinCacheUsage;
|
||||
extern CFeeRate minRelayTxFee;
|
||||
extern bool fAlerts;
|
||||
extern bool fPermitReplacement;
|
||||
|
||||
/** Best header we've seen so far (used for getheaders queries' starting points). */
|
||||
extern CBlockIndex *pindexBestHeader;
|
||||
|
Loading…
Reference in New Issue
Block a user