@@ -462,26 +462,26 @@ UniValue sendtoaddress(const JSONRPCRequest& request)
462
462
463
463
// Wallet comments
464
464
CWalletTx wtx;
465
- if (request. params . size () > 2 && !request.params [2 ].isNull () && !request.params [2 ].get_str ().empty ())
465
+ if (!request.params [2 ].isNull () && !request.params [2 ].get_str ().empty ())
466
466
wtx.mapValue [" comment" ] = request.params [2 ].get_str ();
467
- if (request. params . size () > 3 && !request.params [3 ].isNull () && !request.params [3 ].get_str ().empty ())
467
+ if (!request.params [3 ].isNull () && !request.params [3 ].get_str ().empty ())
468
468
wtx.mapValue [" to" ] = request.params [3 ].get_str ();
469
469
470
470
bool fSubtractFeeFromAmount = false ;
471
- if (request. params . size () > 4 && !request.params [4 ].isNull ()) {
471
+ if (!request.params [4 ].isNull ()) {
472
472
fSubtractFeeFromAmount = request.params [4 ].get_bool ();
473
473
}
474
474
475
475
CCoinControl coin_control;
476
- if (request. params . size () > 5 && !request.params [5 ].isNull ()) {
476
+ if (!request.params [5 ].isNull ()) {
477
477
coin_control.signalRbf = request.params [5 ].get_bool ();
478
478
}
479
479
480
- if (request. params . size () > 6 && !request.params [6 ].isNull ()) {
480
+ if (!request.params [6 ].isNull ()) {
481
481
coin_control.m_confirm_target = ParseConfirmTarget (request.params [6 ]);
482
482
}
483
483
484
- if (request. params . size () > 7 && !request.params [7 ].isNull ()) {
484
+ if (!request.params [7 ].isNull ()) {
485
485
if (!FeeModeFromString (request.params [7 ].get_str (), coin_control.m_fee_mode )) {
486
486
throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid estimate_mode parameter" );
487
487
}
@@ -904,9 +904,9 @@ UniValue sendfrom(const JSONRPCRequest& request)
904
904
905
905
CWalletTx wtx;
906
906
wtx.strFromAccount = strAccount;
907
- if (request. params . size () > 4 && !request.params [4 ].isNull () && !request.params [4 ].get_str ().empty ())
907
+ if (!request.params [4 ].isNull () && !request.params [4 ].get_str ().empty ())
908
908
wtx.mapValue [" comment" ] = request.params [4 ].get_str ();
909
- if (request. params . size () > 5 && !request.params [5 ].isNull () && !request.params [5 ].get_str ().empty ())
909
+ if (!request.params [5 ].isNull () && !request.params [5 ].get_str ().empty ())
910
910
wtx.mapValue [" to" ] = request.params [5 ].get_str ();
911
911
912
912
EnsureWalletIsUnlocked (pwallet);
@@ -986,23 +986,23 @@ UniValue sendmany(const JSONRPCRequest& request)
986
986
987
987
CWalletTx wtx;
988
988
wtx.strFromAccount = strAccount;
989
- if (request. params . size () > 3 && !request.params [3 ].isNull () && !request.params [3 ].get_str ().empty ())
989
+ if (!request.params [3 ].isNull () && !request.params [3 ].get_str ().empty ())
990
990
wtx.mapValue [" comment" ] = request.params [3 ].get_str ();
991
991
992
992
UniValue subtractFeeFromAmount (UniValue::VARR);
993
- if (request. params . size () > 4 && !request.params [4 ].isNull ())
993
+ if (!request.params [4 ].isNull ())
994
994
subtractFeeFromAmount = request.params [4 ].get_array ();
995
995
996
996
CCoinControl coin_control;
997
- if (request. params . size () > 5 && !request.params [5 ].isNull ()) {
997
+ if (!request.params [5 ].isNull ()) {
998
998
coin_control.signalRbf = request.params [5 ].get_bool ();
999
999
}
1000
1000
1001
- if (request. params . size () > 6 && !request.params [6 ].isNull ()) {
1001
+ if (!request.params [6 ].isNull ()) {
1002
1002
coin_control.m_confirm_target = ParseConfirmTarget (request.params [6 ]);
1003
1003
}
1004
1004
1005
- if (request. params . size () > 7 && !request.params [7 ].isNull ()) {
1005
+ if (!request.params [7 ].isNull ()) {
1006
1006
if (!FeeModeFromString (request.params [7 ].get_str (), coin_control.m_fee_mode )) {
1007
1007
throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid estimate_mode parameter" );
1008
1008
}
@@ -2670,19 +2670,19 @@ UniValue listunspent(const JSONRPCRequest& request)
2670
2670
);
2671
2671
2672
2672
int nMinDepth = 1 ;
2673
- if (request. params . size () > 0 && !request.params [0 ].isNull ()) {
2673
+ if (!request.params [0 ].isNull ()) {
2674
2674
RPCTypeCheckArgument (request.params [0 ], UniValue::VNUM);
2675
2675
nMinDepth = request.params [0 ].get_int ();
2676
2676
}
2677
2677
2678
2678
int nMaxDepth = 9999999 ;
2679
- if (request. params . size () > 1 && !request.params [1 ].isNull ()) {
2679
+ if (!request.params [1 ].isNull ()) {
2680
2680
RPCTypeCheckArgument (request.params [1 ], UniValue::VNUM);
2681
2681
nMaxDepth = request.params [1 ].get_int ();
2682
2682
}
2683
2683
2684
2684
std::set<CBitcoinAddress> setAddress;
2685
- if (request. params . size () > 2 && !request.params [2 ].isNull ()) {
2685
+ if (!request.params [2 ].isNull ()) {
2686
2686
RPCTypeCheckArgument (request.params [2 ], UniValue::VARR);
2687
2687
UniValue inputs = request.params [2 ].get_array ();
2688
2688
for (unsigned int idx = 0 ; idx < inputs.size (); idx++) {
@@ -2697,7 +2697,7 @@ UniValue listunspent(const JSONRPCRequest& request)
2697
2697
}
2698
2698
2699
2699
bool include_unsafe = true ;
2700
- if (request. params . size () > 3 && !request.params [3 ].isNull ()) {
2700
+ if (!request.params [3 ].isNull ()) {
2701
2701
RPCTypeCheckArgument (request.params [3 ], UniValue::VBOOL);
2702
2702
include_unsafe = request.params [3 ].get_bool ();
2703
2703
}
@@ -3112,7 +3112,7 @@ UniValue generate(const JSONRPCRequest& request)
3112
3112
3113
3113
int num_generate = request.params [0 ].get_int ();
3114
3114
uint64_t max_tries = 1000000 ;
3115
- if (request. params . size () > 1 && !request.params [1 ].isNull ()) {
3115
+ if (!request.params [1 ].isNull ()) {
3116
3116
max_tries = request.params [1 ].get_int ();
3117
3117
}
3118
3118
0 commit comments