mempool: Replace maxFeeRate of 10000*minRelayTxFee with maxTxFee
This commit is contained in:
parent
2187f93703
commit
386245e164
|
@ -424,8 +424,6 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||||
strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), DEFAULT_SPEND_ZEROCONF_CHANGE));
|
strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), DEFAULT_SPEND_ZEROCONF_CHANGE));
|
||||||
strUsage += HelpMessageOpt("-txconfirmtarget=<n>", strprintf(_("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), DEFAULT_TX_CONFIRM_TARGET));
|
strUsage += HelpMessageOpt("-txconfirmtarget=<n>", strprintf(_("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), DEFAULT_TX_CONFIRM_TARGET));
|
||||||
strUsage += HelpMessageOpt("-txexpirydelta", strprintf(_("Set the number of blocks after which a transaction that has not been mined will become invalid (min: %u, default: %u (pre-Blossom) or %u (post-Blossom))"), TX_EXPIRING_SOON_THRESHOLD + 1, DEFAULT_PRE_BLOSSOM_TX_EXPIRY_DELTA, DEFAULT_POST_BLOSSOM_TX_EXPIRY_DELTA));
|
strUsage += HelpMessageOpt("-txexpirydelta", strprintf(_("Set the number of blocks after which a transaction that has not been mined will become invalid (min: %u, default: %u (pre-Blossom) or %u (post-Blossom))"), TX_EXPIRING_SOON_THRESHOLD + 1, DEFAULT_PRE_BLOSSOM_TX_EXPIRY_DELTA, DEFAULT_POST_BLOSSOM_TX_EXPIRY_DELTA));
|
||||||
strUsage += HelpMessageOpt("-maxtxfee=<amt>", strprintf(_("Maximum total fees (in %s) to use in a single wallet transaction; setting this too low may abort large transactions (default: %s)"),
|
|
||||||
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MAXFEE)));
|
|
||||||
strUsage += HelpMessageOpt("-upgradewallet", _("Upgrade wallet to latest format on startup"));
|
strUsage += HelpMessageOpt("-upgradewallet", _("Upgrade wallet to latest format on startup"));
|
||||||
strUsage += HelpMessageOpt("-wallet=<file>", _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), "wallet.dat"));
|
strUsage += HelpMessageOpt("-wallet=<file>", _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), "wallet.dat"));
|
||||||
strUsage += HelpMessageOpt("-walletbroadcast", _("Make the wallet broadcast transactions") + " " + strprintf(_("(default: %u)"), DEFAULT_WALLETBROADCAST));
|
strUsage += HelpMessageOpt("-walletbroadcast", _("Make the wallet broadcast transactions") + " " + strprintf(_("(default: %u)"), DEFAULT_WALLETBROADCAST));
|
||||||
|
@ -484,6 +482,8 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||||
}
|
}
|
||||||
strUsage += HelpMessageOpt("-minrelaytxfee=<amt>", strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)"),
|
strUsage += HelpMessageOpt("-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)));
|
CURRENCY_UNIT, FormatMoney(DEFAULT_MIN_RELAY_TX_FEE)));
|
||||||
|
strUsage += HelpMessageOpt("-maxtxfee=<amt>", strprintf(_("Maximum total fees (in %s) to use in a single wallet transaction or raw transaction; setting this too low may abort large transactions (default: %s)"),
|
||||||
|
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MAXFEE)));
|
||||||
strUsage += HelpMessageOpt("-printtoconsole", _("Send trace/debug info to console instead of debug.log file"));
|
strUsage += HelpMessageOpt("-printtoconsole", _("Send trace/debug info to console instead of debug.log file"));
|
||||||
if (showDebug)
|
if (showDebug)
|
||||||
{
|
{
|
||||||
|
@ -1069,7 +1069,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||||
CAmount nFeePerK = 0;
|
CAmount nFeePerK = 0;
|
||||||
if (!ParseMoney(mapArgs["-paytxfee"], nFeePerK))
|
if (!ParseMoney(mapArgs["-paytxfee"], nFeePerK))
|
||||||
return InitError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s'"), mapArgs["-paytxfee"]));
|
return InitError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s'"), mapArgs["-paytxfee"]));
|
||||||
if (nFeePerK > nHighTransactionFeeWarning)
|
if (nFeePerK > HIGH_TX_FEE_PER_KB)
|
||||||
InitWarning(_("-paytxfee is set very high! This is the transaction fee you will pay if you send a transaction."));
|
InitWarning(_("-paytxfee is set very high! This is the transaction fee you will pay if you send a transaction."));
|
||||||
payTxFee = CFeeRate(nFeePerK, 1000);
|
payTxFee = CFeeRate(nFeePerK, 1000);
|
||||||
if (payTxFee < ::minRelayTxFee)
|
if (payTxFee < ::minRelayTxFee)
|
||||||
|
@ -1083,7 +1083,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||||
CAmount nMaxFee = 0;
|
CAmount nMaxFee = 0;
|
||||||
if (!ParseMoney(mapArgs["-maxtxfee"], nMaxFee))
|
if (!ParseMoney(mapArgs["-maxtxfee"], nMaxFee))
|
||||||
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s'"), mapArgs["-maptxfee"]));
|
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s'"), mapArgs["-maptxfee"]));
|
||||||
if (nMaxFee > nHighTransactionMaxFeeWarning)
|
if (nMaxFee > HIGH_MAX_TX_FEE)
|
||||||
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
|
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
|
||||||
maxTxFee = nMaxFee;
|
maxTxFee = nMaxFee;
|
||||||
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
|
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
|
||||||
|
|
|
@ -81,14 +81,12 @@ bool fCoinbaseEnforcedShieldingEnabled = true;
|
||||||
size_t nCoinCacheUsage = 5000 * 300;
|
size_t nCoinCacheUsage = 5000 * 300;
|
||||||
uint64_t nPruneTarget = 0;
|
uint64_t nPruneTarget = 0;
|
||||||
bool fAlerts = DEFAULT_ALERTS;
|
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;
|
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
|
||||||
|
|
||||||
boost::optional<unsigned int> expiryDeltaArg = boost::none;
|
boost::optional<unsigned int> expiryDeltaArg = boost::none;
|
||||||
|
|
||||||
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying, mining and transaction creation) */
|
|
||||||
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
|
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
|
||||||
|
CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE;
|
||||||
|
|
||||||
CTxMemPool mempool(::minRelayTxFee);
|
CTxMemPool mempool(::minRelayTxFee);
|
||||||
|
|
||||||
|
@ -1438,10 +1436,10 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||||
dFreeCount += nSize;
|
dFreeCount += nSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fRejectAbsurdFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000) {
|
if (fRejectAbsurdFee && nFees > maxTxFee) {
|
||||||
string errmsg = strprintf("absurdly high fees %s, %d > %d",
|
string errmsg = strprintf("absurdly high fees %s, %d > %d",
|
||||||
hash.ToString(),
|
hash.ToString(),
|
||||||
nFees, ::minRelayTxFee.GetFee(nSize) * 10000);
|
nFees, maxTxFee);
|
||||||
LogPrint("mempool", errmsg.c_str());
|
LogPrint("mempool", errmsg.c_str());
|
||||||
return state.Error("AcceptToMemoryPool: " + errmsg);
|
return state.Error("AcceptToMemoryPool: " + errmsg);
|
||||||
}
|
}
|
||||||
|
|
10
src/main.h
10
src/main.h
|
@ -61,6 +61,12 @@ static const int ALERT_PRIORITY_SAFE_MODE = 4000;
|
||||||
static const unsigned int MAX_REORG_LENGTH = COINBASE_MATURITY - 1;
|
static const unsigned int MAX_REORG_LENGTH = COINBASE_MATURITY - 1;
|
||||||
/** Default for -minrelaytxfee, minimum relay fee for transactions */
|
/** Default for -minrelaytxfee, minimum relay fee for transactions */
|
||||||
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 100;
|
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 100;
|
||||||
|
//! -maxtxfee default
|
||||||
|
static const CAmount DEFAULT_TRANSACTION_MAXFEE = 0.1 * COIN;
|
||||||
|
//! Discourage users to set fees higher than this amount (in satoshis) per kB
|
||||||
|
static const CAmount HIGH_TX_FEE_PER_KB = 0.01 * COIN;
|
||||||
|
//! -maxtxfee will warn if called with a higher fee than this amount (in satoshis)
|
||||||
|
static const CAmount HIGH_MAX_TX_FEE = 100 * HIGH_TX_FEE_PER_KB;
|
||||||
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */
|
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */
|
||||||
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
|
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
|
||||||
/** Default for -txexpirydelta, in number of blocks */
|
/** Default for -txexpirydelta, in number of blocks */
|
||||||
|
@ -160,8 +166,12 @@ extern bool fCheckpointsEnabled;
|
||||||
// it is unneeded for testing
|
// it is unneeded for testing
|
||||||
extern bool fCoinbaseEnforcedShieldingEnabled;
|
extern bool fCoinbaseEnforcedShieldingEnabled;
|
||||||
extern size_t nCoinCacheUsage;
|
extern size_t nCoinCacheUsage;
|
||||||
|
/** A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) */
|
||||||
extern CFeeRate minRelayTxFee;
|
extern CFeeRate minRelayTxFee;
|
||||||
|
/** Absolute maximum transaction fee (in satoshis) used by wallet and mempool (rejects high fee in sendrawtransaction) */
|
||||||
|
extern CAmount maxTxFee;
|
||||||
extern bool fAlerts;
|
extern bool fAlerts;
|
||||||
|
/* 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;
|
||||||
|
|
||||||
/** Best header we've seen so far (used for getheaders queries' starting points). */
|
/** Best header we've seen so far (used for getheaders queries' starting points). */
|
||||||
|
|
|
@ -41,7 +41,6 @@ using namespace libzcash;
|
||||||
* Settings
|
* Settings
|
||||||
*/
|
*/
|
||||||
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE);
|
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE);
|
||||||
CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE;
|
|
||||||
unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET;
|
unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET;
|
||||||
bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE;
|
bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE;
|
||||||
bool fSendFreeTransactions = DEFAULT_SEND_FREE_TRANSACTIONS;
|
bool fSendFreeTransactions = DEFAULT_SEND_FREE_TRANSACTIONS;
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
* Settings
|
* Settings
|
||||||
*/
|
*/
|
||||||
extern CFeeRate payTxFee;
|
extern CFeeRate payTxFee;
|
||||||
extern CAmount maxTxFee;
|
|
||||||
extern unsigned int nTxConfirmTarget;
|
extern unsigned int nTxConfirmTarget;
|
||||||
extern bool bSpendZeroConfChange;
|
extern bool bSpendZeroConfChange;
|
||||||
extern bool fSendFreeTransactions;
|
extern bool fSendFreeTransactions;
|
||||||
|
@ -51,12 +50,8 @@ extern bool fPayAtLeastCustomFee;
|
||||||
static const unsigned int DEFAULT_KEYPOOL_SIZE = 100;
|
static const unsigned int DEFAULT_KEYPOOL_SIZE = 100;
|
||||||
//! -paytxfee default
|
//! -paytxfee default
|
||||||
static const CAmount DEFAULT_TRANSACTION_FEE = 0;
|
static const CAmount DEFAULT_TRANSACTION_FEE = 0;
|
||||||
//! -paytxfee will warn if called with a higher fee than this amount (in satoshis) per KB
|
|
||||||
static const CAmount nHighTransactionFeeWarning = 0.01 * COIN;
|
|
||||||
//! -mintxfee default
|
//! -mintxfee default
|
||||||
static const CAmount DEFAULT_TRANSACTION_MINFEE = 1000;
|
static const CAmount DEFAULT_TRANSACTION_MINFEE = 1000;
|
||||||
//! -maxtxfee default
|
|
||||||
static const CAmount DEFAULT_TRANSACTION_MAXFEE = 0.1 * COIN;
|
|
||||||
//! minimum change amount
|
//! minimum change amount
|
||||||
static const CAmount MIN_CHANGE = CENT;
|
static const CAmount MIN_CHANGE = CENT;
|
||||||
//! Default for -spendzeroconfchange
|
//! Default for -spendzeroconfchange
|
||||||
|
@ -65,8 +60,6 @@ static const bool DEFAULT_SPEND_ZEROCONF_CHANGE = true;
|
||||||
static const bool DEFAULT_SEND_FREE_TRANSACTIONS = false;
|
static const bool DEFAULT_SEND_FREE_TRANSACTIONS = false;
|
||||||
//! -txconfirmtarget default
|
//! -txconfirmtarget default
|
||||||
static const unsigned int DEFAULT_TX_CONFIRM_TARGET = 2;
|
static const unsigned int DEFAULT_TX_CONFIRM_TARGET = 2;
|
||||||
//! -maxtxfee will warn if called with a higher fee than this amount (in satoshis)
|
|
||||||
static const CAmount nHighTransactionMaxFeeWarning = 100 * nHighTransactionFeeWarning;
|
|
||||||
//! Largest (in bytes) free transaction we're willing to create
|
//! Largest (in bytes) free transaction we're willing to create
|
||||||
static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000;
|
static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000;
|
||||||
static const bool DEFAULT_WALLETBROADCAST = true;
|
static const bool DEFAULT_WALLETBROADCAST = true;
|
||||||
|
@ -397,6 +390,7 @@ public:
|
||||||
int GetDepthInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
|
int GetDepthInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
|
||||||
bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; }
|
bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; }
|
||||||
int GetBlocksToMaturity() const;
|
int GetBlocksToMaturity() const;
|
||||||
|
/** Pass this transaction to the mempool. Fails if absolute fee exceeds maxTxFee. */
|
||||||
bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectAbsurdFee=true);
|
bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectAbsurdFee=true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue