aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpc/addresses.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/rpc/addresses.cpp')
-rw-r--r--src/wallet/rpc/addresses.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp
index 903a569cb9..95e1ba4dd9 100644
--- a/src/wallet/rpc/addresses.cpp
+++ b/src/wallet/rpc/addresses.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2011-2021 The Bitcoin Core developers
+// Copyright (c) 2011-2022 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -43,9 +43,7 @@ RPCHelpMan getnewaddress()
}
// Parse the label first so we don't generate a key if there's an error
- std::string label;
- if (!request.params[0].isNull())
- label = LabelFromValue(request.params[0]);
+ const std::string label{LabelFromValue(request.params[0])};
OutputType output_type = pwallet->m_default_address_type;
if (!request.params[1].isNull()) {
@@ -140,7 +138,7 @@ RPCHelpMan setlabel()
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
}
- std::string label = LabelFromValue(request.params[1]);
+ const std::string label{LabelFromValue(request.params[1])};
if (pwallet->IsMine(dest)) {
pwallet->SetAddressBook(dest, label, "receive");
@@ -258,9 +256,7 @@ RPCHelpMan addmultisigaddress()
LOCK2(pwallet->cs_wallet, spk_man.cs_KeyStore);
- std::string label;
- if (!request.params[2].isNull())
- label = LabelFromValue(request.params[2]);
+ const std::string label{LabelFromValue(request.params[2])};
int required = request.params[0].getInt<int>();
@@ -662,7 +658,7 @@ RPCHelpMan getaddressesbylabel()
LOCK(pwallet->cs_wallet);
- std::string label = LabelFromValue(request.params[0]);
+ const std::string label{LabelFromValue(request.params[0])};
// Find all addresses that have the given label
UniValue ret(UniValue::VOBJ);