mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-28 12:50:17 +02:00
Remove ::dustRelayFee
This commit is contained in:
parent
fa8a7f01fe
commit
fadc14e4f5
10
src/init.cpp
10
src/init.cpp
@ -971,16 +971,6 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
|
||||
}
|
||||
}
|
||||
|
||||
// Feerate used to define dust. Shouldn't be changed lightly as old
|
||||
// implementations may inadvertently create non-standard transactions
|
||||
if (args.IsArgSet("-dustrelayfee")) {
|
||||
if (std::optional<CAmount> parsed = ParseMoney(args.GetArg("-dustrelayfee", ""))) {
|
||||
dustRelayFee = CFeeRate{parsed.value()};
|
||||
} else {
|
||||
return InitError(AmountErrMsg("dustrelayfee", args.GetArg("-dustrelayfee", "")));
|
||||
}
|
||||
}
|
||||
|
||||
nBytesPerSigOp = args.GetIntArg("-bytespersigop", nBytesPerSigOp);
|
||||
|
||||
if (!g_wallet_init_interface.ParameterInteraction()) return false;
|
||||
|
@ -39,6 +39,7 @@ struct MemPoolOptions {
|
||||
CFeeRate incremental_relay_feerate{DEFAULT_INCREMENTAL_RELAY_FEE};
|
||||
/** A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) */
|
||||
CFeeRate min_relay_feerate{DEFAULT_MIN_RELAY_TX_FEE};
|
||||
CFeeRate dust_relay_feerate{DUST_RELAY_TX_FEE};
|
||||
bool require_standard{true};
|
||||
bool full_rbf{DEFAULT_MEMPOOL_FULL_RBF};
|
||||
MemPoolLimits limits{};
|
||||
|
@ -67,6 +67,16 @@ std::optional<bilingual_str> ApplyArgsManOptions(const ArgsManager& argsman, con
|
||||
LogPrintf("Increasing minrelaytxfee to %s to match incrementalrelayfee\n", mempool_opts.min_relay_feerate.ToString());
|
||||
}
|
||||
|
||||
// Feerate used to define dust. Shouldn't be changed lightly as old
|
||||
// implementations may inadvertently create non-standard transactions
|
||||
if (argsman.IsArgSet("-dustrelayfee")) {
|
||||
if (std::optional<CAmount> parsed = ParseMoney(argsman.GetArg("-dustrelayfee", ""))) {
|
||||
mempool_opts.dust_relay_feerate = CFeeRate{parsed.value()};
|
||||
} else {
|
||||
return AmountErrMsg("dustrelayfee", argsman.GetArg("-dustrelayfee", ""));
|
||||
}
|
||||
}
|
||||
|
||||
mempool_opts.require_standard = !argsman.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard());
|
||||
if (!chainparams.IsTestChain() && !mempool_opts.require_standard) {
|
||||
return strprintf(Untranslated("acceptnonstdtxn is not currently supported for %s chain"), chainparams.NetworkIDString());
|
||||
|
@ -301,7 +301,11 @@ public:
|
||||
}
|
||||
}
|
||||
bool getNetworkActive() override { return m_context->connman && m_context->connman->GetNetworkActive(); }
|
||||
CFeeRate getDustRelayFee() override { return ::dustRelayFee; }
|
||||
CFeeRate getDustRelayFee() override
|
||||
{
|
||||
if (!m_context->mempool) return CFeeRate{DUST_RELAY_TX_FEE};
|
||||
return m_context->mempool->m_dust_relay_feerate;
|
||||
}
|
||||
UniValue executeRpc(const std::string& command, const UniValue& params, const std::string& uri) override
|
||||
{
|
||||
JSONRPCRequest req;
|
||||
@ -686,7 +690,11 @@ public:
|
||||
if (!m_node.mempool) return CFeeRate{DEFAULT_INCREMENTAL_RELAY_FEE};
|
||||
return m_node.mempool->m_incremental_relay_feerate;
|
||||
}
|
||||
CFeeRate relayDustFee() override { return ::dustRelayFee; }
|
||||
CFeeRate relayDustFee() override
|
||||
{
|
||||
if (!m_node.mempool) return CFeeRate{DUST_RELAY_TX_FEE};
|
||||
return m_node.mempool->m_dust_relay_feerate;
|
||||
}
|
||||
bool havePruned() override
|
||||
{
|
||||
LOCK(::cs_main);
|
||||
|
@ -5,9 +5,7 @@
|
||||
|
||||
#include <policy/settings.h>
|
||||
|
||||
#include <policy/feerate.h>
|
||||
#include <policy/policy.h>
|
||||
|
||||
bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG;
|
||||
CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE);
|
||||
unsigned int nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP;
|
||||
|
@ -6,14 +6,12 @@
|
||||
#ifndef BITCOIN_POLICY_SETTINGS_H
|
||||
#define BITCOIN_POLICY_SETTINGS_H
|
||||
|
||||
#include <policy/feerate.h>
|
||||
#include <policy/policy.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class CTransaction;
|
||||
|
||||
extern CFeeRate dustRelayFee;
|
||||
extern unsigned int nBytesPerSigOp;
|
||||
extern bool fIsBareMultisigStd;
|
||||
|
||||
|
@ -460,6 +460,7 @@ CTxMemPool::CTxMemPool(const Options& opts)
|
||||
m_expiry{opts.expiry},
|
||||
m_incremental_relay_feerate{opts.incremental_relay_feerate},
|
||||
m_min_relay_feerate{opts.min_relay_feerate},
|
||||
m_dust_relay_feerate{opts.dust_relay_feerate},
|
||||
m_require_standard{opts.require_standard},
|
||||
m_full_rbf{opts.full_rbf},
|
||||
m_limits{opts.limits}
|
||||
|
@ -570,6 +570,7 @@ public:
|
||||
const std::chrono::seconds m_expiry;
|
||||
const CFeeRate m_incremental_relay_feerate;
|
||||
const CFeeRate m_min_relay_feerate;
|
||||
const CFeeRate m_dust_relay_feerate;
|
||||
const bool m_require_standard;
|
||||
const bool m_full_rbf;
|
||||
|
||||
|
@ -700,7 +700,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
|
||||
|
||||
// Rather not work on nonstandard transactions (unless -testnet/-regtest)
|
||||
std::string reason;
|
||||
if (m_pool.m_require_standard && !IsStandardTx(tx, ::fIsBareMultisigStd, ::dustRelayFee, reason)) {
|
||||
if (m_pool.m_require_standard && !IsStandardTx(tx, ::fIsBareMultisigStd, m_pool.m_dust_relay_feerate, reason)) {
|
||||
return state.Invalid(TxValidationResult::TX_NOT_STANDARD, reason);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ CFeeRate GetDiscardRate(const CWallet& wallet)
|
||||
CFeeRate discard_rate = wallet.chain().estimateSmartFee(highest_target, false /* conservative */);
|
||||
// Don't let discard_rate be greater than longest possible fee estimate if we get a valid fee estimate
|
||||
discard_rate = (discard_rate == CFeeRate(0)) ? wallet.m_discard_rate : std::min(discard_rate, wallet.m_discard_rate);
|
||||
// Discard rate must be at least dustRelayFee
|
||||
// Discard rate must be at least dust relay feerate
|
||||
discard_rate = std::max(discard_rate, wallet.chain().relayDustFee());
|
||||
return discard_rate;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user