mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
rpc: Add MaybeArg() and Arg() default helper
This commit is contained in:
@@ -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 \"*\".");
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user