Skip to content

Commit fa96d76

Browse files
author
MarcoFalke
committed
rpc: Uncouple rpcs from maxTxFee global
1 parent fa965e0 commit fa96d76

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ void SetupServerArgs()
500500
gArgs.AddArg("-mocktime=<n>", "Replace actual time with <n> seconds since epoch (default: 0)", true, OptionsCategory::DEBUG_TEST);
501501
gArgs.AddArg("-maxsigcachesize=<n>", strprintf("Limit sum of signature cache and script execution cache sizes to <n> MiB (default: %u)", DEFAULT_MAX_SIG_CACHE_SIZE), true, OptionsCategory::DEBUG_TEST);
502502
gArgs.AddArg("-maxtipage=<n>", strprintf("Maximum tip age in seconds to consider node in initial block download (default: %u)", DEFAULT_MAX_TIP_AGE), true, OptionsCategory::DEBUG_TEST);
503-
gArgs.AddArg("-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)",
503+
gArgs.AddArg("-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)", // TODO move setting to wallet
504504
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MAXFEE)), false, OptionsCategory::DEBUG_TEST);
505505
gArgs.AddArg("-printpriority", strprintf("Log transaction fee per kB when mining blocks (default: %u)", DEFAULT_PRINTPRIORITY), true, OptionsCategory::DEBUG_TEST);
506506
gArgs.AddArg("-printtoconsole", "Send trace/debug info to console (default: 1 when no -daemon. To disable logging to file, set -nodebuglogfile)", false, OptionsCategory::DEBUG_TEST);

src/rpc/rawtransaction.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
#include <univalue.h>
4141

42+
constexpr static CAmount DEFAULT_MAX_RAW_TX_FEE{COIN / 10};
4243

4344
static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
4445
{
@@ -1038,7 +1039,7 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
10381039
"\nAlso see createrawtransaction and signrawtransactionwithkey calls.\n",
10391040
{
10401041
{"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex string of the raw transaction"},
1041-
{"maxfeerate", RPCArg::Type::AMOUNT, /* default */ FormatMoney(maxTxFee), "Reject transactions whose fee rate is higher than the specified value, expressed in " + CURRENCY_UNIT + "/kB\n"},
1042+
{"maxfeerate", RPCArg::Type::AMOUNT, /* default */ FormatMoney(DEFAULT_MAX_RAW_TX_FEE), "Reject transactions whose fee rate is higher than the specified value, expressed in " + CURRENCY_UNIT + "/kB\n"},
10421043
},
10431044
RPCResult{
10441045
"\"hex\" (string) The transaction hash in hex\n"
@@ -1070,7 +1071,7 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
10701071
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
10711072
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
10721073

1073-
CAmount max_raw_tx_fee = maxTxFee;
1074+
CAmount max_raw_tx_fee = DEFAULT_MAX_RAW_TX_FEE;
10741075
// TODO: temporary migration code for old clients. Remove in v0.20
10751076
if (request.params[1].isBool()) {
10761077
throw JSONRPCError(RPC_INVALID_PARAMETER, "Second argument must be numeric (maxfeerate) and no longer supports a boolean. To allow a transaction with high fees, set maxfeerate to 0.");
@@ -1108,7 +1109,7 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
11081109
{"rawtx", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, ""},
11091110
},
11101111
},
1111-
{"maxfeerate", RPCArg::Type::AMOUNT, /* default */ FormatMoney(maxTxFee), "Reject transactions whose fee rate is higher than the specified value, expressed in " + CURRENCY_UNIT + "/kB\n"},
1112+
{"maxfeerate", RPCArg::Type::AMOUNT, /* default */ FormatMoney(DEFAULT_MAX_RAW_TX_FEE), "Reject transactions whose fee rate is higher than the specified value, expressed in " + CURRENCY_UNIT + "/kB\n"},
11121113
},
11131114
RPCResult{
11141115
"[ (array) The result of the mempool acceptance test for each raw transaction in the input array.\n"
@@ -1152,7 +1153,7 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
11521153
CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
11531154
const uint256& tx_hash = tx->GetHash();
11541155

1155-
CAmount max_raw_tx_fee = maxTxFee;
1156+
CAmount max_raw_tx_fee = DEFAULT_MAX_RAW_TX_FEE;
11561157
// TODO: temporary migration code for old clients. Remove in v0.20
11571158
if (request.params[1].isBool()) {
11581159
throw JSONRPCError(RPC_INVALID_PARAMETER, "Second argument must be numeric (maxfeerate) and no longer supports a boolean. To allow a transaction with high fees, set maxfeerate to 0.");

0 commit comments

Comments
 (0)