Skip to content

Commit e68d380

Browse files
committed
rpc: remove unneeded RPCTypeCheckArgument checks
No-behavior change. Since #25629, we check the univalue type internally.
1 parent 5556663 commit e68d380

File tree

4 files changed

+2
-15
lines changed

4 files changed

+2
-15
lines changed

src/rpc/fees.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ static RPCHelpMan estimatesmartfee()
6464
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
6565
{
6666
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VSTR});
67-
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
6867

6968
CBlockPolicyEstimator& fee_estimator = EnsureAnyFeeEstimator(request.context);
7069
const NodeContext& node = EnsureAnyNodeContext(request.context);
@@ -157,7 +156,6 @@ static RPCHelpMan estimaterawfee()
157156
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
158157
{
159158
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VNUM}, true);
160-
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
161159

162160
CBlockPolicyEstimator& fee_estimator = EnsureAnyFeeEstimator(request.context);
163161

src/rpc/mempool.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,7 @@ static RPCHelpMan gettxspendingprevout()
605605
},
606606
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
607607
{
608-
RPCTypeCheckArgument(request.params[0], UniValue::VARR);
609-
const UniValue& output_params = request.params[0];
608+
const UniValue& output_params = request.params[0].get_array();
610609
if (output_params.empty()) {
611610
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, outputs are missing");
612611
}

src/wallet/rpc/coins.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@ RPCHelpMan lockunspent()
290290

291291
LOCK(pwallet->cs_wallet);
292292

293-
RPCTypeCheckArgument(request.params[0], UniValue::VBOOL);
294-
295293
bool fUnlock = request.params[0].get_bool();
296294

297295
const bool persistent{request.params[2].isNull() ? false : request.params[2].get_bool()};
@@ -304,9 +302,7 @@ RPCHelpMan lockunspent()
304302
return true;
305303
}
306304

307-
RPCTypeCheckArgument(request.params[1], UniValue::VARR);
308-
309-
const UniValue& output_params = request.params[1];
305+
const UniValue& output_params = request.params[1].get_array();
310306

311307
// Create and validate the COutPoints first.
312308

@@ -566,19 +562,16 @@ RPCHelpMan listunspent()
566562

567563
int nMinDepth = 1;
568564
if (!request.params[0].isNull()) {
569-
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
570565
nMinDepth = request.params[0].getInt<int>();
571566
}
572567

573568
int nMaxDepth = 9999999;
574569
if (!request.params[1].isNull()) {
575-
RPCTypeCheckArgument(request.params[1], UniValue::VNUM);
576570
nMaxDepth = request.params[1].getInt<int>();
577571
}
578572

579573
std::set<CTxDestination> destinations;
580574
if (!request.params[2].isNull()) {
581-
RPCTypeCheckArgument(request.params[2], UniValue::VARR);
582575
UniValue inputs = request.params[2].get_array();
583576
for (unsigned int idx = 0; idx < inputs.size(); idx++) {
584577
const UniValue& input = inputs[idx];
@@ -594,7 +587,6 @@ RPCHelpMan listunspent()
594587

595588
bool include_unsafe = true;
596589
if (!request.params[3].isNull()) {
597-
RPCTypeCheckArgument(request.params[3], UniValue::VBOOL);
598590
include_unsafe = request.params[3].get_bool();
599591
}
600592

src/wallet/rpc/spend.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,6 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out,
503503
coinControl.fAllowWatchOnly = options.get_bool();
504504
}
505505
else {
506-
RPCTypeCheckArgument(options, UniValue::VOBJ);
507506
RPCTypeCheckObj(options,
508507
{
509508
{"add_inputs", UniValueType(UniValue::VBOOL)},
@@ -1644,7 +1643,6 @@ RPCHelpMan walletcreatefundedpsbt()
16441643
bool rbf{wallet.m_signal_rbf};
16451644
const UniValue &replaceable_arg = options["replaceable"];
16461645
if (!replaceable_arg.isNull()) {
1647-
RPCTypeCheckArgument(replaceable_arg, UniValue::VBOOL);
16481646
rbf = replaceable_arg.isTrue();
16491647
}
16501648
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], rbf);

0 commit comments

Comments
 (0)