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: b768108d9c
This commit is contained in:
Wladimir J. van der Laan
2016-01-21 11:11:01 +01:00
parent e25b158ab8
commit da83ecd454
3 changed files with 14 additions and 4 deletions

View File

@@ -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)