File tree Expand file tree Collapse file tree 5 files changed +16
-18
lines changed
Expand file tree Collapse file tree 5 files changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -2149,15 +2149,16 @@ static RPCHelpMan scantxoutset()
21492149 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
21502150{
21512151 UniValue result (UniValue::VOBJ);
2152- if (request.params [0 ].get_str () == " status" ) {
2152+ const auto action{self.Arg <std::string>(" action" )};
2153+ if (action == " status" ) {
21532154 CoinsViewScanReserver reserver;
21542155 if (reserver.reserve ()) {
21552156 // no scan in progress
21562157 return UniValue::VNULL;
21572158 }
21582159 result.pushKV (" progress" , g_scan_progress.load ());
21592160 return result;
2160- } else if (request. params [ 0 ]. get_str () == " abort" ) {
2161+ } else if (action == " abort" ) {
21612162 CoinsViewScanReserver reserver;
21622163 if (reserver.reserve ()) {
21632164 // reserve was possible which means no scan was running
@@ -2166,7 +2167,7 @@ static RPCHelpMan scantxoutset()
21662167 // set the abort flag
21672168 g_should_abort_scan = true ;
21682169 return true ;
2169- } else if (request. params [ 0 ]. get_str () == " start" ) {
2170+ } else if (action == " start" ) {
21702171 CoinsViewScanReserver reserver;
21712172 if (!reserver.reserve ()) {
21722173 throw JSONRPCError (RPC_INVALID_PARAMETER, " Scan already in progress, use action \" abort\" or \" status\" " );
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ static RPCHelpMan getnetworkhashps()
118118{
119119 ChainstateManager& chainman = EnsureAnyChainman (request.context );
120120 LOCK (cs_main);
121- return GetNetworkHashPS (self.Arg <int >(0 ), self.Arg <int >(1 ), chainman.ActiveChain ());
121+ return GetNetworkHashPS (self.Arg <int >(" nblocks " ), self.Arg <int >(" height " ), chainman.ActiveChain ());
122122},
123123 };
124124}
@@ -225,12 +225,12 @@ static RPCHelpMan generatetodescriptor()
225225 " \n Generate 11 blocks to mydesc\n " + HelpExampleCli (" generatetodescriptor" , " 11 \" mydesc\" " )},
226226 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
227227{
228- const auto num_blocks{self.Arg <int >(0 )};
229- const auto max_tries{self.Arg <uint64_t >(2 )};
228+ const auto num_blocks{self.Arg <int >(" num_blocks " )};
229+ const auto max_tries{self.Arg <uint64_t >(" maxtries " )};
230230
231231 CScript coinbase_script;
232232 std::string error;
233- if (!getScriptFromDescriptor (self.Arg <std::string>(1 ), coinbase_script, error)) {
233+ if (!getScriptFromDescriptor (self.Arg <std::string>(" descriptor " ), coinbase_script, error)) {
234234 throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, error);
235235 }
236236
Original file line number Diff line number Diff line change @@ -322,7 +322,7 @@ static RPCHelpMan addnode()
322322 },
323323 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
324324{
325- const std::string command{request. params [ 1 ]. get_str ( )};
325+ const auto command{self. Arg <std::string>( " command " )};
326326 if (command != " onetry" && command != " add" && command != " remove" ) {
327327 throw std::runtime_error (
328328 self.ToString ());
@@ -331,9 +331,9 @@ static RPCHelpMan addnode()
331331 NodeContext& node = EnsureAnyNodeContext (request.context );
332332 CConnman& connman = EnsureConnman (node);
333333
334- const std::string node_arg{request. params [ 0 ]. get_str ( )};
334+ const auto node_arg{self. Arg <std::string>( " node " )};
335335 bool node_v2transport = connman.GetLocalServices () & NODE_P2P_V2;
336- bool use_v2transport = self.MaybeArg <bool >(2 ).value_or (node_v2transport);
336+ bool use_v2transport = self.MaybeArg <bool >(" v2transport " ).value_or (node_v2transport);
337337
338338 if (use_v2transport && !node_v2transport) {
339339 throw JSONRPCError (RPC_INVALID_PARAMETER, " Error: v2transport requested but not enabled (see -v2transport)" );
Original file line number Diff line number Diff line change @@ -38,9 +38,9 @@ static RPCHelpMan verifymessage()
3838 },
3939 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
4040 {
41- std::string strAddress = request. params [ 0 ]. get_str ( );
42- std::string strSign = request. params [ 1 ]. get_str ( );
43- std::string strMessage = request. params [ 2 ]. get_str ( );
41+ std::string strAddress = self. Arg <std::string>( " address " );
42+ std::string strSign = self. Arg <std::string>( " signature " );
43+ std::string strMessage = self. Arg <std::string>( " message " );
4444
4545 switch (MessageVerify (strAddress, strSign, strMessage)) {
4646 case MessageVerificationResult::ERR_INVALID_ADDRESS:
Original file line number Diff line number Diff line change @@ -194,15 +194,12 @@ RPCHelpMan getbalance()
194194
195195 LOCK (pwallet->cs_wallet );
196196
197- const auto dummy_value{self.MaybeArg <std::string>(0 )};
197+ const auto dummy_value{self.MaybeArg <std::string>(" dummy " )};
198198 if (dummy_value && *dummy_value != " *" ) {
199199 throw JSONRPCError (RPC_METHOD_DEPRECATED, " dummy first argument must be excluded or set to \" *\" ." );
200200 }
201201
202- int min_depth = 0 ;
203- if (!request.params [1 ].isNull ()) {
204- min_depth = request.params [1 ].getInt <int >();
205- }
202+ const auto min_depth{self.Arg <int >(" minconf" )};
206203
207204 bool include_watchonly = ParseIncludeWatchonly (request.params [2 ], *pwallet);
208205
You can’t perform that action at this time.
0 commit comments