Skip to content

Commit

Permalink
wallet: Add utility method for CanSupportFeature
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Oct 19, 2020
1 parent a1e0359 commit 842ae38
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
bool IsTrusted(const CWalletTx& wtx, std::set<uint256>& trusted_parents) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);

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

/**
* populate vCoins with vector of available COutputs.
Expand Down
5 changes: 5 additions & 0 deletions src/wallet/walletutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,8 @@ std::vector<fs::path> ListWalletDir()

return paths;
}

bool IsFeatureSupported(int wallet_version, int feature_version)
{
return wallet_version >= feature_version;
}
2 changes: 1 addition & 1 deletion src/wallet/walletutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ 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
Expand Down

0 comments on commit 842ae38

Please sign in to comment.