aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/rawtransaction.cpp
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-04-08 15:40:57 +0100
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-04-08 16:12:54 +0100
commitaa410c2b17c0320123fde3d3bf205a64d86b8696 (patch)
tree4b6acbba6367568c17817b572f4015cb553d6d7d /src/rpc/rawtransaction.cpp
parent327d2746fb9240ff0751a7c8f501c9745ba55bba (diff)
rpc: Validate maxfeerate with AmountFromValue
Diffstat (limited to 'src/rpc/rawtransaction.cpp')
-rw-r--r--src/rpc/rawtransaction.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 8d9c207011..950b1e1ac8 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -1090,15 +1090,13 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
// TODO: temporary migration code for old clients. Remove in v0.20
if (request.params[1].isBool()) {
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.");
- } else if (request.params[1].isNum()) {
+ } else if (!request.params[1].isNull()) {
size_t weight = GetTransactionWeight(*tx);
CFeeRate fr(AmountFromValue(request.params[1]));
// the +3/4 part rounds the value up, and is the same formula used when
// calculating the fee for a transaction
// (see GetVirtualTransactionSize)
max_raw_tx_fee = fr.GetFee((weight+3)/4);
- } else if (!request.params[1].isNull()) {
- throw JSONRPCError(RPC_INVALID_PARAMETER, "second argument (maxfeerate) must be numeric");
}
uint256 txid;
@@ -1172,15 +1170,13 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
// TODO: temporary migration code for old clients. Remove in v0.20
if (request.params[1].isBool()) {
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.");
- } else if (request.params[1].isNum()) {
+ } else if (!request.params[1].isNull()) {
size_t weight = GetTransactionWeight(*tx);
CFeeRate fr(AmountFromValue(request.params[1]));
// the +3/4 part rounds the value up, and is the same formula used when
// calculating the fee for a transaction
// (see GetVirtualTransactionSize)
max_raw_tx_fee = fr.GetFee((weight+3)/4);
- } else if (!request.params[1].isNull()) {
- throw JSONRPCError(RPC_INVALID_PARAMETER, "second argument (maxfeerate) must be numeric");
}
UniValue result(UniValue::VARR);