aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/walletutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/walletutil.cpp')
-rw-r--r--src/wallet/walletutil.cpp13
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);
+}