mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Make it possible to unconditionally RBF with mempoolreplacement=fee,-optin
This commit is contained in:
parent
d0cccad9d4
commit
0853a234a4
3 changed files with 16 additions and 1 deletions
10
src/init.cpp
10
src/init.cpp
|
|
@ -1153,8 +1153,16 @@ bool AppInitParameterInteraction()
|
||||||
// Minimal effort at forwards compatibility
|
// Minimal effort at forwards compatibility
|
||||||
std::string strReplacementModeList = gArgs.GetArg("-mempoolreplacement", ""); // default is impossible
|
std::string strReplacementModeList = gArgs.GetArg("-mempoolreplacement", ""); // default is impossible
|
||||||
std::vector<std::string> vstrReplacementModes;
|
std::vector<std::string> vstrReplacementModes;
|
||||||
boost::split(vstrReplacementModes, strReplacementModeList, boost::is_any_of(","));
|
boost::split(vstrReplacementModes, strReplacementModeList, boost::is_any_of(",+"));
|
||||||
fEnableReplacement = (std::find(vstrReplacementModes.begin(), vstrReplacementModes.end(), "fee") != vstrReplacementModes.end());
|
fEnableReplacement = (std::find(vstrReplacementModes.begin(), vstrReplacementModes.end(), "fee") != vstrReplacementModes.end());
|
||||||
|
if (fEnableReplacement) {
|
||||||
|
fReplacementHonourOptOut = (std::find(vstrReplacementModes.begin(), vstrReplacementModes.end(), "-optin") == vstrReplacementModes.end());
|
||||||
|
if (!fReplacementHonourOptOut) {
|
||||||
|
nLocalServices = ServiceFlags(nLocalServices | NODE_REPLACE_BY_FEE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fReplacementHonourOptOut = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -233,6 +233,7 @@ size_t nCoinCacheUsage = 5000 * 300;
|
||||||
uint64_t nPruneTarget = 0;
|
uint64_t nPruneTarget = 0;
|
||||||
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
|
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
|
||||||
bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT;
|
bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT;
|
||||||
|
bool fReplacementHonourOptOut = DEFAULT_REPLACEMENT_HONOUR_OPTOUT;
|
||||||
|
|
||||||
uint256 hashAssumeValid;
|
uint256 hashAssumeValid;
|
||||||
arith_uint256 nMinimumChainWork;
|
arith_uint256 nMinimumChainWork;
|
||||||
|
|
@ -623,6 +624,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
|
||||||
bool fReplacementOptOut = true;
|
bool fReplacementOptOut = true;
|
||||||
if (fEnableReplacement)
|
if (fEnableReplacement)
|
||||||
{
|
{
|
||||||
|
if (fReplacementHonourOptOut) {
|
||||||
for (const CTxIn &_txin : ptxConflicting->vin)
|
for (const CTxIn &_txin : ptxConflicting->vin)
|
||||||
{
|
{
|
||||||
if (_txin.nSequence <= MAX_BIP125_RBF_SEQUENCE)
|
if (_txin.nSequence <= MAX_BIP125_RBF_SEQUENCE)
|
||||||
|
|
@ -631,6 +633,9 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fReplacementOptOut = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (fReplacementOptOut) {
|
if (fReplacementOptOut) {
|
||||||
return state.Invalid(false, REJECT_DUPLICATE, "txn-mempool-conflict");
|
return state.Invalid(false, REJECT_DUPLICATE, "txn-mempool-conflict");
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100;
|
||||||
static const bool DEFAULT_PERSIST_MEMPOOL = true;
|
static const bool DEFAULT_PERSIST_MEMPOOL = true;
|
||||||
/** Default for -mempoolreplacement */
|
/** Default for -mempoolreplacement */
|
||||||
static const bool DEFAULT_ENABLE_REPLACEMENT = true;
|
static const bool DEFAULT_ENABLE_REPLACEMENT = true;
|
||||||
|
static const bool DEFAULT_REPLACEMENT_HONOUR_OPTOUT = true;
|
||||||
/** Default for using fee filter */
|
/** Default for using fee filter */
|
||||||
static const bool DEFAULT_FEEFILTER = true;
|
static const bool DEFAULT_FEEFILTER = true;
|
||||||
|
|
||||||
|
|
@ -169,6 +170,7 @@ extern CAmount maxTxFee;
|
||||||
/** 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 fEnableReplacement;
|
extern bool fEnableReplacement;
|
||||||
|
extern bool fReplacementHonourOptOut;
|
||||||
|
|
||||||
/** Block hash whose ancestors we will assume to have valid scripts without checking them. */
|
/** Block hash whose ancestors we will assume to have valid scripts without checking them. */
|
||||||
extern uint256 hashAssumeValid;
|
extern uint256 hashAssumeValid;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue