mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-04 13:55:23 -05:00
wallet: Add GetClosestWalletFeature function
Given a version number, get the closest supported WalletFeature for a version number.
This commit is contained in:
parent
842ae3842d
commit
5f720544f3
2 changed files with 14 additions and 0 deletions
|
@ -75,3 +75,16 @@ bool IsFeatureSupported(int wallet_version, int feature_version)
|
||||||
{
|
{
|
||||||
return wallet_version >= feature_version;
|
return wallet_version >= feature_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WalletFeature GetClosestWalletFeature(int version)
|
||||||
|
{
|
||||||
|
if (version >= FEATURE_LATEST) return FEATURE_LATEST;
|
||||||
|
if (version >= FEATURE_PRE_SPLIT_KEYPOOL) return FEATURE_PRE_SPLIT_KEYPOOL;
|
||||||
|
if (version >= FEATURE_NO_DEFAULT_KEY) return FEATURE_NO_DEFAULT_KEY;
|
||||||
|
if (version >= FEATURE_HD_SPLIT) return FEATURE_HD_SPLIT;
|
||||||
|
if (version >= FEATURE_HD) return FEATURE_HD;
|
||||||
|
if (version >= FEATURE_COMPRPUBKEY) return FEATURE_COMPRPUBKEY;
|
||||||
|
if (version >= FEATURE_WALLETCRYPT) return FEATURE_WALLETCRYPT;
|
||||||
|
if (version >= FEATURE_BASE) return FEATURE_BASE;
|
||||||
|
return static_cast<WalletFeature>(0);
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ enum WalletFeature
|
||||||
};
|
};
|
||||||
|
|
||||||
bool IsFeatureSupported(int wallet_version, int feature_version);
|
bool IsFeatureSupported(int wallet_version, int feature_version);
|
||||||
|
WalletFeature GetClosestWalletFeature(int version);
|
||||||
|
|
||||||
enum WalletFlags : uint64_t {
|
enum WalletFlags : uint64_t {
|
||||||
// wallet flags in the upper section (> 1 << 31) will lead to not opening the wallet if flag is unknown
|
// wallet flags in the upper section (> 1 << 31) will lead to not opening the wallet if flag is unknown
|
||||||
|
|
Loading…
Add table
Reference in a new issue