mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-01-31 10:30:52 +00:00
Fix: parse -maxtxfee outside of CWallet
This preserves the effect of -maxtxfee even when -disablewallet is active.
This commit is contained in:
parent
3a29ba6d49
commit
1372b1dbe2
21
src/init.cpp
21
src/init.cpp
@ -1016,7 +1016,6 @@ bool AppInitParameterInteraction()
|
||||
CAmount n = 0;
|
||||
if (!ParseMoney(GetArg("-minrelaytxfee", ""), n) || 0 == n)
|
||||
return InitError(AmountErrMsg("minrelaytxfee", GetArg("-minrelaytxfee", "")));
|
||||
// High fee check is done afterward in CWallet::ParameterInteraction()
|
||||
::minRelayTxFeeRate = CFeeRate(n);
|
||||
} else if (incrementalRelayFee > ::minRelayTxFeeRate) {
|
||||
// Allow only setting incrementalRelayFee to control both
|
||||
@ -1024,6 +1023,26 @@ bool AppInitParameterInteraction()
|
||||
LogPrintf("Increasing minrelaytxfee to %s to match incrementalrelayfee\n",::minRelayTxFeeRate.ToString());
|
||||
}
|
||||
|
||||
// This is the maximum absolute fee (in COIN, not satoshis)
|
||||
// that is allowed for sendrawtransaction RPC and CWallet
|
||||
// This must be parsed outside of CWallet code in order to
|
||||
// keep its effect on the RPC even when -disablewallet is
|
||||
// active.
|
||||
if (IsArgSet("-maxtxfee"))
|
||||
{
|
||||
CAmount nMaxFee = 0;
|
||||
if (!ParseMoney(GetArg("-maxtxfee", ""), nMaxFee))
|
||||
return InitError(AmountErrMsg("maxtxfee", GetArg("-maxtxfee", "")));
|
||||
if (nMaxFee > HIGH_MAX_TX_FEE)
|
||||
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
|
||||
::maxTxFee = nMaxFee;
|
||||
if (CFeeRate(::maxTxFee, 1000) < ::minRelayTxFeeRate)
|
||||
{
|
||||
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
|
||||
GetArg("-maxtxfee", ""), ::minRelayTxFeeRate.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
// Sanity check argument for min fee for including tx in block
|
||||
// TODO: Harmonize which arguments need sanity checking and where that happens
|
||||
if (IsArgSet("-blockmintxfee"))
|
||||
|
||||
@ -3961,20 +3961,6 @@ bool CWallet::ParameterInteraction()
|
||||
CWallet::minTxFee = CFeeRate(nFeePerK,1000);
|
||||
}
|
||||
}
|
||||
if (IsArgSet("-maxtxfee"))
|
||||
{
|
||||
CAmount nMaxFee = 0;
|
||||
if (!ParseMoney(GetArg("-maxtxfee", ""), nMaxFee))
|
||||
return InitError(AmountErrMsg("maxtxfee", GetArg("-maxtxfee", "")));
|
||||
if (nMaxFee > HIGH_MAX_TX_FEE)
|
||||
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
|
||||
maxTxFee = nMaxFee;
|
||||
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFeeRate)
|
||||
{
|
||||
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
|
||||
GetArg("-maxtxfee", ""), ::minRelayTxFeeRate.ToString()));
|
||||
}
|
||||
}
|
||||
if (IsArgSet("-discardthreshold"))
|
||||
{
|
||||
CAmount nDiscardThreshold = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user