aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-08-07 14:53:42 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-08-24 10:44:45 +0200
commitc00000df1605788acadceb90c22ae9f00db8a9dc (patch)
tree547e525ac6821f751bcca2dd9534043aa75fc382 /src/wallet
parentcd5d2f5f0938ad4f8737caf4e7c501101818fd36 (diff)
rpc: Add MaybeArg() and Arg() default helper
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/rpc/coins.cpp4
-rw-r--r--src/wallet/rpc/wallet.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/wallet/rpc/coins.cpp b/src/wallet/rpc/coins.cpp
index 6f0623cdf5..fdc6ee055d 100644
--- a/src/wallet/rpc/coins.cpp
+++ b/src/wallet/rpc/coins.cpp
@@ -194,8 +194,8 @@ RPCHelpMan getbalance()
LOCK(pwallet->cs_wallet);
- const UniValue& dummy_value = request.params[0];
- if (!dummy_value.isNull() && dummy_value.get_str() != "*") {
+ const auto dummy_value{self.MaybeArg<std::string>(0)};
+ if (dummy_value && *dummy_value != "*") {
throw JSONRPCError(RPC_METHOD_DEPRECATED, "dummy first argument must be excluded or set to \"*\".");
}
diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp
index fb4b642bba..3774e6a3ef 100644
--- a/src/wallet/rpc/wallet.cpp
+++ b/src/wallet/rpc/wallet.cpp
@@ -478,7 +478,7 @@ static RPCHelpMan unloadwallet()
// Release the "main" shared pointer and prevent further notifications.
// Note that any attempt to load the same wallet would fail until the wallet
// is destroyed (see CheckUniqueFileid).
- std::optional<bool> load_on_start = request.params[1].isNull() ? std::nullopt : std::optional<bool>(request.params[1].get_bool());
+ std::optional<bool> load_on_start{self.MaybeArg<bool>(1)};
if (!RemoveWallet(context, wallet, load_on_start, warnings)) {
throw JSONRPCError(RPC_MISC_ERROR, "Requested wallet already unloaded");
}