From 7cda3d0f5bdca64b11f966a60167cde5451071a3 Mon Sep 17 00:00:00 2001 From: woltx <94266259+w0xlt@users.noreply.github.com> Date: Tue, 15 Jul 2025 00:56:53 -0700 Subject: [PATCH] wallet: Remove `IsFeatureSupported()` and `CanSupportFeature()` --- src/wallet/rpc/wallet.cpp | 4 +--- src/wallet/scriptpubkeyman.h | 1 - src/wallet/wallet.h | 3 --- src/wallet/walletutil.cpp | 5 ----- src/wallet/walletutil.h | 2 -- 5 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp index d68118994bf..0a844fcee53 100644 --- a/src/wallet/rpc/wallet.cpp +++ b/src/wallet/rpc/wallet.cpp @@ -90,10 +90,8 @@ static RPCHelpMan getwalletinfo() obj.pushKV("format", pwallet->GetDatabase().Format()); obj.pushKV("txcount", (int)pwallet->mapWallet.size()); obj.pushKV("keypoolsize", (int64_t)kpExternalSize); + obj.pushKV("keypoolsize_hd_internal", pwallet->GetKeyPoolSize() - kpExternalSize); - if (pwallet->CanSupportFeature(FEATURE_HD_SPLIT)) { - obj.pushKV("keypoolsize_hd_internal", (int64_t)(pwallet->GetKeyPoolSize() - kpExternalSize)); - } if (pwallet->IsCrypted()) { obj.pushKV("unlocked_until", pwallet->nRelockTime); } diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h index c6f6e37f2b9..f8086fdbff7 100644 --- a/src/wallet/scriptpubkeyman.h +++ b/src/wallet/scriptpubkeyman.h @@ -47,7 +47,6 @@ public: virtual WalletDatabase& GetDatabase() const = 0; virtual bool IsWalletFlagSet(uint64_t) const = 0; virtual void UnsetBlankWalletFlag(WalletBatch&) = 0; - virtual bool CanSupportFeature(enum WalletFeature) const = 0; virtual void SetMinVersion(enum WalletFeature, WalletBatch* = nullptr) = 0; //! Pass the encryption key to cb(). virtual bool WithEncryptionKey(std::function cb) const = 0; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 1b1080fd81c..c7c6c3c1070 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -556,9 +556,6 @@ public: int GetTxBlocksToMaturity(const CWalletTx& wtx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); bool IsTxImmatureCoinBase(const CWalletTx& wtx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); - //! check whether we support the named feature - bool CanSupportFeature(enum WalletFeature wf) const override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { AssertLockHeld(cs_wallet); return IsFeatureSupported(nWalletVersion, wf); } - bool IsSpent(const COutPoint& outpoint) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); // Whether this or any known scriptPubKey with the same single key has been spent. diff --git a/src/wallet/walletutil.cpp b/src/wallet/walletutil.cpp index 9b296aebed9..3ee296a6725 100644 --- a/src/wallet/walletutil.cpp +++ b/src/wallet/walletutil.cpp @@ -32,11 +32,6 @@ fs::path GetWalletDir() return path; } -bool IsFeatureSupported(int wallet_version, int feature_version) -{ - return wallet_version >= feature_version; -} - WalletDescriptor GenerateWalletDescriptor(const CExtPubKey& master_key, const OutputType& addr_type, bool internal) { int64_t creation_time = GetTime(); diff --git a/src/wallet/walletutil.h b/src/wallet/walletutil.h index ca0786c1f37..ba93a90ed97 100644 --- a/src/wallet/walletutil.h +++ b/src/wallet/walletutil.h @@ -30,8 +30,6 @@ enum WalletFeature FEATURE_LATEST = FEATURE_PRE_SPLIT_KEYPOOL }; -bool IsFeatureSupported(int wallet_version, int feature_version); - enum WalletFlags : uint64_t { // wallet flags in the upper section (> 1 << 31) will lead to not opening the wallet if flag is unknown // unknown wallet flags in the lower section <= (1 << 31) will be tolerated