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

View File

@@ -78,6 +78,7 @@ bool fAlerts = DEFAULT_ALERTS;
/* If the tip is older than this (in seconds), the node is considered to be in initial block download.
*/
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
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);
@@ -868,12 +869,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)