Skip to content

Commit fa91d57

Browse files
author
MarcoFalke
committed
remove unused AddrToPubKey
1 parent faecf15 commit fa91d57

File tree

3 files changed

+2
-27
lines changed

3 files changed

+2
-27
lines changed

src/rpc/util.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2022 The Bitcoin Core developers
1+
// Copyright (c) 2017-present The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -234,27 +234,6 @@ CPubKey HexToPubKey(const std::string& hex_in)
234234
return vchPubKey;
235235
}
236236

237-
// Retrieves a public key for an address from the given FillableSigningProvider
238-
CPubKey AddrToPubKey(const FillableSigningProvider& keystore, const std::string& addr_in)
239-
{
240-
CTxDestination dest = DecodeDestination(addr_in);
241-
if (!IsValidDestination(dest)) {
242-
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address: " + addr_in);
243-
}
244-
CKeyID key = GetKeyForDestination(keystore, dest);
245-
if (key.IsNull()) {
246-
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("'%s' does not refer to a key", addr_in));
247-
}
248-
CPubKey vchPubKey;
249-
if (!keystore.GetPubKey(key, vchPubKey)) {
250-
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("no full public key for address %s", addr_in));
251-
}
252-
if (!vchPubKey.IsFullyValid()) {
253-
throw JSONRPCError(RPC_INTERNAL_ERROR, "Wallet contains an invalid public key");
254-
}
255-
return vchPubKey;
256-
}
257-
258237
// Creates a multisig address from a given list of public keys, number of signatures required, and the address type
259238
CTxDestination AddAndGetMultisigDestination(const int required, const std::vector<CPubKey>& pubkeys, OutputType type, FlatSigningProvider& keystore, CScript& script_out)
260239
{

src/rpc/util.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2022 The Bitcoin Core developers
1+
// Copyright (c) 2017-present The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -132,7 +132,6 @@ std::string HelpExampleRpc(const std::string& methodname, const std::string& arg
132132
std::string HelpExampleRpcNamed(const std::string& methodname, const RPCArgList& args);
133133

134134
CPubKey HexToPubKey(const std::string& hex_in);
135-
CPubKey AddrToPubKey(const FillableSigningProvider& keystore, const std::string& addr_in);
136135
CTxDestination AddAndGetMultisigDestination(const int required, const std::vector<CPubKey>& pubkeys, OutputType type, FlatSigningProvider& keystore, CScript& script_out);
137136

138137
UniValue DescribeAddress(const CTxDestination& dest);

src/test/fuzz/key.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,6 @@ FUZZ_TARGET(key, .init = initialize_key)
186186
const std::string destination_address = EncodeDestination(tx_destination);
187187
assert(DecodeDestination(destination_address) == tx_destination);
188188

189-
const CPubKey pubkey_from_address_string = AddrToPubKey(fillable_signing_provider, destination_address);
190-
assert(pubkey_from_address_string == pubkey);
191-
192189
CKeyID key_id = pubkey.GetID();
193190
assert(!key_id.IsNull());
194191
assert(key_id == CKeyID{key_id});

0 commit comments

Comments
 (0)