1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
crate::ix!();

/**
  | (client) version numbers for particular
  | wallet features
  |
  */
bitflags!{

    pub struct WalletFeature: u32 {

        /*
          | the earliest version new wallets supports
          | (only useful for getwalletinfo's clientversion
          | output)
          |
          */
        const FEATURE_BASE              = 10500; 

        /*
          | wallet encryption
          |
          */
        const FEATURE_WALLETCRYPT       = 40000; 

        /*
          | compressed public keys
          |
          */
        const FEATURE_COMPRPUBKEY       = 60000; 

        /*
          | Hierarchical key derivation after
          | BIP32 (HD Wallet)
          |
          */
        const FEATURE_HD                = 130000; 

        /*
          | Wallet with HD chain split (change outputs
          | will use m/0'/1'/k)
          |
          */
        const FEATURE_HD_SPLIT          = 139900; 

        /*
          | Wallet without a default key written
          |
          */
        const FEATURE_NO_DEFAULT_KEY    = 159900; 

        /*
          | Upgraded to HD SPLIT and can have a pre-split
          | keypool
          |
          */
        const FEATURE_PRE_SPLIT_KEYPOOL = 169900; 

        const FEATURE_LATEST            = Self::FEATURE_PRE_SPLIT_KEYPOOL.bits;
    }
}

pub fn is_feature_supported(
        wallet_version:  i32,
        feature_version: i32) -> bool {
    
    todo!();
        /*
            return wallet_version >= feature_version;
        */
}

pub fn get_closest_wallet_feature(version: i32) -> WalletFeature {
    
    todo!();
        /*
            static constexpr std::array wallet_features{FEATURE_LATEST, FEATURE_PRE_SPLIT_KEYPOOL, FEATURE_NO_DEFAULT_KEY, FEATURE_HD_SPLIT, FEATURE_HD, FEATURE_COMPRPUBKEY, FEATURE_WALLETCRYPT, FEATURE_BASE};
        for (const WalletFeature& wf : wallet_features) {
            if (version >= wf) return wf;
        }
        return static_cast<WalletFeature>(0);
        */
}