mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
wallet: replace raw pointer with const reference in AddrToPubKey
This commit is contained in:
@@ -131,18 +131,18 @@ CPubKey HexToPubKey(const std::string& hex_in)
|
||||
}
|
||||
|
||||
// Retrieves a public key for an address from the given FillableSigningProvider
|
||||
CPubKey AddrToPubKey(FillableSigningProvider* const keystore, const std::string& addr_in)
|
||||
CPubKey AddrToPubKey(const FillableSigningProvider& keystore, const std::string& addr_in)
|
||||
{
|
||||
CTxDestination dest = DecodeDestination(addr_in);
|
||||
if (!IsValidDestination(dest)) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address: " + addr_in);
|
||||
}
|
||||
CKeyID key = GetKeyForDestination(*keystore, dest);
|
||||
CKeyID key = GetKeyForDestination(keystore, dest);
|
||||
if (key.IsNull()) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("%s does not refer to a key", addr_in));
|
||||
}
|
||||
CPubKey vchPubKey;
|
||||
if (!keystore->GetPubKey(key, vchPubKey)) {
|
||||
if (!keystore.GetPubKey(key, vchPubKey)) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("no full public key for address %s", addr_in));
|
||||
}
|
||||
if (!vchPubKey.IsFullyValid()) {
|
||||
|
||||
Reference in New Issue
Block a user