Skip to content

Commit 1a3a256

Browse files
committed
wallet: replace raw pointer with const reference in AddrToPubKey
1 parent 239d199 commit 1a3a256

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/rpc/util.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,18 @@ CPubKey HexToPubKey(const std::string& hex_in)
131131
}
132132

133133
// Retrieves a public key for an address from the given FillableSigningProvider
134-
CPubKey AddrToPubKey(FillableSigningProvider* const keystore, const std::string& addr_in)
134+
CPubKey AddrToPubKey(const FillableSigningProvider& keystore, const std::string& addr_in)
135135
{
136136
CTxDestination dest = DecodeDestination(addr_in);
137137
if (!IsValidDestination(dest)) {
138138
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address: " + addr_in);
139139
}
140-
CKeyID key = GetKeyForDestination(*keystore, dest);
140+
CKeyID key = GetKeyForDestination(keystore, dest);
141141
if (key.IsNull()) {
142142
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("%s does not refer to a key", addr_in));
143143
}
144144
CPubKey vchPubKey;
145-
if (!keystore->GetPubKey(key, vchPubKey)) {
145+
if (!keystore.GetPubKey(key, vchPubKey)) {
146146
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("no full public key for address %s", addr_in));
147147
}
148148
if (!vchPubKey.IsFullyValid()) {

src/rpc/util.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ extern std::string HelpExampleCli(const std::string& methodname, const std::stri
6969
extern std::string HelpExampleRpc(const std::string& methodname, const std::string& args);
7070

7171
CPubKey HexToPubKey(const std::string& hex_in);
72-
CPubKey AddrToPubKey(FillableSigningProvider* const keystore, const std::string& addr_in);
72+
CPubKey AddrToPubKey(const FillableSigningProvider& keystore, const std::string& addr_in);
7373
CTxDestination AddAndGetMultisigDestination(const int required, const std::vector<CPubKey>& pubkeys, OutputType type, FillableSigningProvider& keystore, CScript& script_out);
7474

7575
UniValue DescribeAddress(const CTxDestination& dest);

src/wallet/rpcwallet.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ static UniValue addmultisigaddress(const JSONRPCRequest& request)
998998
if (IsHex(keys_or_addrs[i].get_str()) && (keys_or_addrs[i].get_str().length() == 66 || keys_or_addrs[i].get_str().length() == 130)) {
999999
pubkeys.push_back(HexToPubKey(keys_or_addrs[i].get_str()));
10001000
} else {
1001-
pubkeys.push_back(AddrToPubKey(&spk_man, keys_or_addrs[i].get_str()));
1001+
pubkeys.push_back(AddrToPubKey(spk_man, keys_or_addrs[i].get_str()));
10021002
}
10031003
}
10041004

0 commit comments

Comments
 (0)