remove unused AddrToPubKey
This commit is contained in:
3 files changed
+2
-27
No files matched your search
+1
-22
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2017-2022 The Bitcoin Core developers
|
// Copyright (c) 2017-present The Bitcoin Core developers
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
@@ -234,27 +234,6 @@ CPubKey HexToPubKey(const std::string& hex_in)
|
|||||||
return vchPubKey;
|
return vchPubKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieves a public key for an address from the given FillableSigningProvider
|
|
||||||
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);
|
|
||||||
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)) {
|
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("no full public key for address %s", addr_in));
|
|
||||||
}
|
|
||||||
if (!vchPubKey.IsFullyValid()) {
|
|
||||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Wallet contains an invalid public key");
|
|
||||||
}
|
|
||||||
return vchPubKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates a multisig address from a given list of public keys, number of signatures required, and the address type
|
// Creates a multisig address from a given list of public keys, number of signatures required, and the address type
|
||||||
CTxDestination AddAndGetMultisigDestination(const int required, const std::vector<CPubKey>& pubkeys, OutputType type, FlatSigningProvider& keystore, CScript& script_out)
|
CTxDestination AddAndGetMultisigDestination(const int required, const std::vector<CPubKey>& pubkeys, OutputType type, FlatSigningProvider& keystore, CScript& script_out)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-2
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2017-2022 The Bitcoin Core developers
|
// Copyright (c) 2017-present The Bitcoin Core developers
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
@@ -132,7 +132,6 @@ std::string HelpExampleRpc(const std::string& methodname, const std::string& arg
|
|||||||
std::string HelpExampleRpcNamed(const std::string& methodname, const RPCArgList& args);
|
std::string HelpExampleRpcNamed(const std::string& methodname, const RPCArgList& args);
|
||||||
|
|
||||||
CPubKey HexToPubKey(const std::string& hex_in);
|
CPubKey HexToPubKey(const std::string& hex_in);
|
||||||
CPubKey AddrToPubKey(const FillableSigningProvider& keystore, const std::string& addr_in);
|
|
||||||
CTxDestination AddAndGetMultisigDestination(const int required, const std::vector<CPubKey>& pubkeys, OutputType type, FlatSigningProvider& keystore, CScript& script_out);
|
CTxDestination AddAndGetMultisigDestination(const int required, const std::vector<CPubKey>& pubkeys, OutputType type, FlatSigningProvider& keystore, CScript& script_out);
|
||||||
|
|
||||||
UniValue DescribeAddress(const CTxDestination& dest);
|
UniValue DescribeAddress(const CTxDestination& dest);
|
||||||
|
|||||||
@@ -186,9 +186,6 @@ FUZZ_TARGET(key, .init = initialize_key)
|
|||||||
const std::string destination_address = EncodeDestination(tx_destination);
|
const std::string destination_address = EncodeDestination(tx_destination);
|
||||||
assert(DecodeDestination(destination_address) == tx_destination);
|
assert(DecodeDestination(destination_address) == tx_destination);
|
||||||
|
|
||||||
const CPubKey pubkey_from_address_string = AddrToPubKey(fillable_signing_provider, destination_address);
|
|
||||||
assert(pubkey_from_address_string == pubkey);
|
|
||||||
|
|
||||||
CKeyID key_id = pubkey.GetID();
|
CKeyID key_id = pubkey.GetID();
|
||||||
assert(!key_id.IsNull());
|
assert(!key_id.IsNull());
|
||||||
assert(key_id == CKeyID{key_id});
|
assert(key_id == CKeyID{key_id});
|
||||||
|
|||||||
Reference in new issue
Block a user