Skip to content

Commit

Permalink
Fix rpc parse fee rate
Browse files Browse the repository at this point in the history
  • Loading branch information
timemarkovqtum committed Oct 15, 2024
1 parent aab151d commit c9c8ac3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/rpc/mempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static RPCHelpMan sendrawtransaction()
{"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex string of the raw transaction"},
{"maxfeerate", RPCArg::Type::AMOUNT, RPCArg::Default{FormatMoney(DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK())},
"Reject transactions whose fee rate is higher than the specified value, expressed in " + CURRENCY_UNIT +
"/kvB.\nFee rates larger than 1BTC/kvB are rejected.\nSet to 0 to accept any fee rate."},
"/kvB.\nFee rates larger than 10QTUM/kvB are rejected.\nSet to 0 to accept any fee rate."},
{"maxburnamount", RPCArg::Type::AMOUNT, RPCArg::Default{FormatMoney(0)},
"Reject transactions with provably unspendable outputs (e.g. 'datacarrier' outputs that use the OP_RETURN opcode) greater than the specified value, expressed in " + CURRENCY_UNIT + ".\n"
"If burning funds through unspendable outputs is desired, increase this value.\n"
Expand Down Expand Up @@ -175,7 +175,7 @@ static RPCHelpMan testmempoolaccept()
},
{"maxfeerate", RPCArg::Type::AMOUNT, RPCArg::Default{FormatMoney(DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK())},
"Reject transactions whose fee rate is higher than the specified value, expressed in " + CURRENCY_UNIT +
"/kvB.\nFee rates larger than 1BTC/kvB are rejected.\nSet to 0 to accept any fee rate."},
"/kvB.\nFee rates larger than 10QTUM/kvB are rejected.\nSet to 0 to accept any fee rate."},
},
RPCResult{
RPCResult::Type::ARR, "", "The result of the mempool acceptance test for each raw transaction in the input array.\n"
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ CAmount AmountFromValue(const UniValue& value, int decimals)
CFeeRate ParseFeeRate(const UniValue& json)
{
CAmount val{AmountFromValue(json)};
if (val >= COIN) throw JSONRPCError(RPC_INVALID_PARAMETER, "Fee rates larger than or equal to 1BTC/kvB are not accepted");
// MAX(val) / DEFAULT_MAX_RAW_TX_FEE_RATE = 10, preserve the proportion
if (val >= 10 * COIN) throw JSONRPCError(RPC_INVALID_PARAMETER, "Fee rates larger than or equal to 10QTUM/kvB are not accepted");
return CFeeRate{val};
}

Expand Down

0 comments on commit c9c8ac3

Please sign in to comment.