mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Merge e2182b02b5 into merged_master (Bitcoin PR #16171)
This commit is contained in:
commit
83f93df4d0
5 changed files with 5 additions and 52 deletions
|
|
@ -634,9 +634,6 @@ Relay and mine data carrier transactions (default: 1)
|
|||
Maximum size of data in data carrier transactions we relay and mine
|
||||
(default: 83)
|
||||
.HP
|
||||
\fB\-mempoolreplacement\fR
|
||||
.IP
|
||||
Enable transaction replacement in the memory pool (default: 1)
|
||||
.HP
|
||||
\fB\-minrelaytxfee=\fR<amt>
|
||||
.IP
|
||||
|
|
|
|||
18
src/init.cpp
18
src/init.cpp
|
|
@ -530,7 +530,6 @@ void SetupServerArgs()
|
|||
gArgs.AddArg("-bytespersigop", strprintf("Equivalent bytes per sigop in transactions for relay and mining (default: %u)", DEFAULT_BYTES_PER_SIGOP), false, OptionsCategory::NODE_RELAY);
|
||||
gArgs.AddArg("-datacarrier", strprintf("Relay and mine data carrier transactions (default: %u)", DEFAULT_ACCEPT_DATACARRIER), false, OptionsCategory::NODE_RELAY);
|
||||
gArgs.AddArg("-datacarriersize", strprintf("Maximum size of data in data carrier transactions we relay and mine (default: %u)", MAX_OP_RETURN_RELAY), false, OptionsCategory::NODE_RELAY);
|
||||
gArgs.AddArg("-mempoolreplacement", strprintf("Enable transaction replacement in the memory pool (default: %u)", DEFAULT_ENABLE_REPLACEMENT), false, OptionsCategory::NODE_RELAY);
|
||||
gArgs.AddArg("-minrelaytxfee=<amt>", strprintf("Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)",
|
||||
CURRENCY_UNIT, FormatMoney(DEFAULT_MIN_RELAY_TX_FEE)), false, OptionsCategory::NODE_RELAY);
|
||||
gArgs.AddArg("-whitelistforcerelay", strprintf("Force relay of transactions from whitelisted peers even if the transactions were already in the mempool or violate local relay policy (default: %d)", DEFAULT_WHITELISTFORCERELAY), false, OptionsCategory::NODE_RELAY);
|
||||
|
|
@ -1219,23 +1218,6 @@ bool AppInitParameterInteraction()
|
|||
|
||||
nMaxTipAge = gArgs.GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
|
||||
|
||||
fEnableReplacement = gArgs.GetBoolArg("-mempoolreplacement", DEFAULT_ENABLE_REPLACEMENT);
|
||||
if ((!fEnableReplacement) && gArgs.IsArgSet("-mempoolreplacement")) {
|
||||
// Minimal effort at forwards compatibility
|
||||
std::string strReplacementModeList = gArgs.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());
|
||||
if (fEnableReplacement) {
|
||||
fReplacementHonourOptOut = (std::find(vstrReplacementModes.begin(), vstrReplacementModes.end(), "-optin") == vstrReplacementModes.end());
|
||||
if (!fReplacementHonourOptOut) {
|
||||
nLocalServices = ServiceFlags(nLocalServices | NODE_REPLACE_BY_FEE);
|
||||
}
|
||||
} else {
|
||||
fReplacementHonourOptOut = true;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const std::string default_asset_name = gArgs.GetArg("-defaultpeggedassetname", "bitcoin");
|
||||
InitGlobalAssetDir(gArgs.GetArgs("-assetdir"), default_asset_name);
|
||||
|
|
|
|||
|
|
@ -114,8 +114,6 @@ bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED;
|
|||
size_t nCoinCacheUsage = 5000 * 300;
|
||||
uint64_t nPruneTarget = 0;
|
||||
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
|
||||
bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT;
|
||||
bool fReplacementHonourOptOut = DEFAULT_REPLACEMENT_HONOUR_OPTOUT;
|
||||
|
||||
uint256 hashAssumeValid;
|
||||
arith_uint256 nMinimumChainWork;
|
||||
|
|
@ -503,20 +501,13 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
|
|||
// unconfirmed ancestors anyway; doing otherwise is hopelessly
|
||||
// insecure.
|
||||
bool fReplacementOptOut = true;
|
||||
if (fEnableReplacement)
|
||||
for (const CTxIn &_txin : ptxConflicting->vin)
|
||||
{
|
||||
if (fReplacementHonourOptOut) {
|
||||
for (const CTxIn &_txin : ptxConflicting->vin)
|
||||
if (_txin.nSequence <= MAX_BIP125_RBF_SEQUENCE)
|
||||
{
|
||||
if (_txin.nSequence <= MAX_BIP125_RBF_SEQUENCE)
|
||||
{
|
||||
fReplacementOptOut = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fReplacementOptOut = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fReplacementOptOut) {
|
||||
return state.Invalid(ValidationInvalidReason::TX_MEMPOOL_POLICY, false, REJECT_DUPLICATE, "txn-mempool-conflict");
|
||||
|
|
|
|||
|
|
@ -120,9 +120,6 @@ static const char* const DEFAULT_BLOCKFILTERINDEX = "0";
|
|||
static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100;
|
||||
/** Default for -persistmempool */
|
||||
static const bool DEFAULT_PERSIST_MEMPOOL = true;
|
||||
/** Default for -mempoolreplacement */
|
||||
static const bool DEFAULT_ENABLE_REPLACEMENT = true;
|
||||
static const bool DEFAULT_REPLACEMENT_HONOUR_OPTOUT = true;
|
||||
/** Default for using fee filter */
|
||||
static const bool DEFAULT_FEEFILTER = true;
|
||||
|
||||
|
|
@ -172,8 +169,6 @@ extern size_t nCoinCacheUsage;
|
|||
extern CFeeRate minRelayTxFee;
|
||||
/** If the tip is older than this (in seconds), the node is considered to be in initial block download. */
|
||||
extern int64_t nMaxTipAge;
|
||||
extern bool fEnableReplacement;
|
||||
extern bool fReplacementHonourOptOut;
|
||||
|
||||
/** Block hash whose ancestors we will assume to have valid scripts without checking them. */
|
||||
extern uint256 hashAssumeValid;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ def make_utxo(node, amount, confirmed=True, scriptPubKey=CScript([1])):
|
|||
|
||||
class ReplaceByFeeTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2
|
||||
self.num_nodes = 1
|
||||
self.extra_args = [
|
||||
[
|
||||
"-maxorphantx=1000",
|
||||
|
|
@ -82,9 +82,6 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
|||
"-limitdescendantcount=200",
|
||||
"-limitdescendantsize=101",
|
||||
],
|
||||
[
|
||||
"-mempoolreplacement=0",
|
||||
],
|
||||
]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
|
|
@ -157,16 +154,12 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
|||
|
||||
# This will raise an exception due to insufficient fee
|
||||
assert_raises_rpc_error(-26, "insufficient fee", self.nodes[0].sendrawtransaction, tx1b_hex, 0)
|
||||
# This will raise an exception due to transaction replacement being disabled
|
||||
assert_raises_rpc_error(-26, "txn-mempool-conflict", self.nodes[1].sendrawtransaction, tx1b_hex, 0)
|
||||
|
||||
# Extra 0.1 BTC fee
|
||||
tx1b = CTransaction()
|
||||
tx1b.vin = [CTxIn(tx0_outpoint, nSequence=0)]
|
||||
tx1b.vout = [CTxOut(int(0.9 * COIN), CScript([b'b' * 35])), feeout, feeout]
|
||||
tx1b_hex = txToHex(tx1b)
|
||||
# Replacement still disabled even with "enough fee"
|
||||
assert_raises_rpc_error(-26, "txn-mempool-conflict", self.nodes[1].sendrawtransaction, tx1b_hex, 0)
|
||||
# Works when enabled
|
||||
tx1b_txid = self.nodes[0].sendrawtransaction(tx1b_hex, 0)
|
||||
|
||||
|
|
@ -177,11 +170,6 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
|||
|
||||
assert_equal(tx1b_hex, self.nodes[0].getrawtransaction(tx1b_txid))
|
||||
|
||||
# Second node is running mempoolreplacement=0, will not replace originally-seen txn
|
||||
mempool = self.nodes[1].getrawmempool()
|
||||
assert tx1a_txid in mempool
|
||||
assert tx1b_txid not in mempool
|
||||
|
||||
def test_doublespend_chain(self):
|
||||
"""Doublespend of a long chain"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue