diff options
author | Andrew Chow <achow101-github@achow101.com> | 2020-04-29 16:58:12 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2020-10-19 00:14:38 -0400 |
commit | 5f720544f34dedf75b063b962845fa8eca604514 (patch) | |
tree | a59e9dd8ae7ad9f4232f2670ae7c8bd5540a785b /src/wallet/walletutil.cpp | |
parent | 842ae3842df489f1b8d68e67a234788966218184 (diff) |
wallet: Add GetClosestWalletFeature function
Given a version number, get the closest supported WalletFeature
for a version number.
Diffstat (limited to 'src/wallet/walletutil.cpp')
-rw-r--r-- | src/wallet/walletutil.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wallet/walletutil.cpp b/src/wallet/walletutil.cpp index 9ac90a21ca..0b7cf692ba 100644 --- a/src/wallet/walletutil.cpp +++ b/src/wallet/walletutil.cpp @@ -75,3 +75,16 @@ bool IsFeatureSupported(int wallet_version, int 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); +} |