Skip to content

Commit 842ae38

Browse files
committed
wallet: Add utility method for CanSupportFeature
1 parent a1e0359 commit 842ae38

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/wallet/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
801801
bool IsTrusted(const CWalletTx& wtx, std::set<uint256>& trusted_parents) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
802802

803803
//! check whether we are allowed to upgrade (or already support) to the named feature
804-
bool CanSupportFeature(enum WalletFeature wf) const override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { AssertLockHeld(cs_wallet); return nWalletMaxVersion >= wf; }
804+
bool CanSupportFeature(enum WalletFeature wf) const override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { AssertLockHeld(cs_wallet); return IsFeatureSupported(nWalletMaxVersion, wf); }
805805

806806
/**
807807
* populate vCoins with vector of available COutputs.

src/wallet/walletutil.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,8 @@ std::vector<fs::path> ListWalletDir()
7070

7171
return paths;
7272
}
73+
74+
bool IsFeatureSupported(int wallet_version, int feature_version)
75+
{
76+
return wallet_version >= feature_version;
77+
}

src/wallet/walletutil.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ enum WalletFeature
2929
FEATURE_LATEST = FEATURE_PRE_SPLIT_KEYPOOL
3030
};
3131

32-
32+
bool IsFeatureSupported(int wallet_version, int feature_version);
3333

3434
enum WalletFlags : uint64_t {
3535
// wallet flags in the upper section (> 1 << 31) will lead to not opening the wallet if flag is unknown

0 commit comments

Comments
 (0)