Skip to content

Commit cbd8e3d

Browse files
committed
Merge bitcoin/bitcoin#32476: refactor: Remove unused HaveKey and HaveWatchOnly
fabdc5a Remove unused LegacyDataSPKM::HaveWatchOnly() (MarcoFalke) fa7b7f7 Remove HaveKey helper, unused after sethdseed removal (MarcoFalke) Pull request description: removes some dead code ACKs for top commit: Sjors: utACK fabdc5a Tree-SHA512: 3cf6838eff6cedfe6a7337071d41e17d34033a2875b3661a6a1741e13c7a8e81b57eb874aebbb9d96d05ea7efa261a3a98e1bcf982b12cfafb163405d860b8bf
2 parents 663a9ca + fabdc5a commit cbd8e3d

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

src/wallet/rpc/wallet.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,17 @@
99
#include <key_io.h>
1010
#include <rpc/server.h>
1111
#include <rpc/util.h>
12+
#include <univalue.h>
1213
#include <util/translation.h>
1314
#include <wallet/context.h>
1415
#include <wallet/receive.h>
15-
#include <wallet/rpc/wallet.h>
1616
#include <wallet/rpc/util.h>
17+
#include <wallet/rpc/wallet.h>
1718
#include <wallet/wallet.h>
1819
#include <wallet/walletutil.h>
1920

2021
#include <optional>
2122

22-
#include <univalue.h>
23-
2423

2524
namespace wallet {
2625

@@ -31,14 +30,6 @@ static const std::map<uint64_t, std::string> WALLET_FLAG_CAVEATS{
3130
"be considered unused, even if the opposite is the case."},
3231
};
3332

34-
/** Checks if a CKey is in the given CWallet compressed or otherwise*/
35-
bool HaveKey(const SigningProvider& wallet, const CKey& key)
36-
{
37-
CKey key2;
38-
key2.Set(key.begin(), key.end(), !key.IsCompressed());
39-
return wallet.HaveKey(key.GetPubKey().GetID()) || wallet.HaveKey(key2.GetPubKey().GetID());
40-
}
41-
4233
static RPCHelpMan getwalletinfo()
4334
{
4435
return RPCHelpMan{"getwalletinfo",

src/wallet/scriptpubkeyman.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2022 The Bitcoin Core developers
1+
// Copyright (c) 2019-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

@@ -343,12 +343,6 @@ bool LegacyDataSPKM::HaveWatchOnly(const CScript &dest) const
343343
return setWatchOnly.count(dest) > 0;
344344
}
345345

346-
bool LegacyDataSPKM::HaveWatchOnly() const
347-
{
348-
LOCK(cs_KeyStore);
349-
return (!setWatchOnly.empty());
350-
}
351-
352346
bool LegacyDataSPKM::LoadWatchOnly(const CScript &dest)
353347
{
354348
return AddWatchOnlyInMem(dest);

src/wallet/scriptpubkeyman.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019-2022 The Bitcoin Core developers
1+
// Copyright (c) 2019-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

@@ -241,8 +241,6 @@ class LegacyDataSPKM : public ScriptPubKeyMan, public FillableSigningProvider
241241
bool LoadWatchOnly(const CScript &dest);
242242
//! Returns whether the watch-only script is in the wallet
243243
bool HaveWatchOnly(const CScript &dest) const;
244-
//! Returns whether there are any watch-only things in the wallet
245-
bool HaveWatchOnly() const;
246244
//! Adds a key to the store, without saving it to disk (used by LoadWallet)
247245
bool LoadKey(const CKey& key, const CPubKey &pubkey);
248246
//! Adds an encrypted key to the store, without saving it to disk (used by LoadWallet)

0 commit comments

Comments
 (0)