From faecf158d997c009a8a492bdf866a5e8cbb8f5e8 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 15 May 2025 14:52:12 +0200 Subject: [PATCH 1/4] remove unused Import* function signatures --- src/wallet/wallet.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index e32b8c7272b..5ea267d6484 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2022 The Bitcoin Core developers +// Copyright (c) 2009-present The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -680,11 +680,6 @@ public: bool SubmitTxMemoryPoolAndRelay(CWalletTx& wtx, std::string& err_string, bool relay) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); - bool ImportScripts(const std::set scripts, int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); - bool ImportPrivKeys(const std::map& privkey_map, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); - bool ImportPubKeys(const std::vector>& ordered_pubkeys, const std::map& pubkey_map, const std::map>& key_origins, const bool add_keypool, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); - bool ImportScriptPubKeys(const std::string& label, const std::set& script_pub_keys, const bool have_solving_data, const bool apply_label, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); - /** Updates wallet birth time if 'time' is below it */ void MaybeUpdateBirthTime(int64_t time); From fa91d57de36d74168e01909ae97d85bfdce2e0f1 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 15 May 2025 14:50:11 +0200 Subject: [PATCH 2/4] remove unused AddrToPubKey --- src/rpc/util.cpp | 23 +---------------------- src/rpc/util.h | 3 +-- src/test/fuzz/key.cpp | 3 --- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index 4c83517c8da..ab925871881 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -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 // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -234,27 +234,6 @@ CPubKey HexToPubKey(const std::string& hex_in) 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 CTxDestination AddAndGetMultisigDestination(const int required, const std::vector& pubkeys, OutputType type, FlatSigningProvider& keystore, CScript& script_out) { diff --git a/src/rpc/util.h b/src/rpc/util.h index 4eafa1eb6e4..df36bc73cc0 100644 --- a/src/rpc/util.h +++ b/src/rpc/util.h @@ -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 // 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); 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& pubkeys, OutputType type, FlatSigningProvider& keystore, CScript& script_out); UniValue DescribeAddress(const CTxDestination& dest); diff --git a/src/test/fuzz/key.cpp b/src/test/fuzz/key.cpp index c7ff2f3a28e..92cf04c0eee 100644 --- a/src/test/fuzz/key.cpp +++ b/src/test/fuzz/key.cpp @@ -186,9 +186,6 @@ FUZZ_TARGET(key, .init = initialize_key) const std::string destination_address = EncodeDestination(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(); assert(!key_id.IsNull()); assert(key_id == CKeyID{key_id}); From fac72fef27de6d8cece9b9d84325589a06fd2a8d Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 15 May 2025 13:42:36 +0200 Subject: [PATCH 3/4] remove unused GetAllDestinationsForKey --- src/outputtype.cpp | 18 ++---------------- src/outputtype.h | 5 +---- src/test/fuzz/key.cpp | 3 +-- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/outputtype.cpp b/src/outputtype.cpp index 8c2b76494bd..702efe81c63 100644 --- a/src/outputtype.cpp +++ b/src/outputtype.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2022 The Bitcoin Core developers +// Copyright (c) 2009-present The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -9,9 +9,8 @@ #include