MCPcopy Create free account
hub / github.com/ElementsProject/elements / CHDChain

Class CHDChain

src/wallet/walletdb.h:90–126  ·  view source on GitHub ↗

simple HD chain data model */

Source from the content-addressed store, hash-verified

88
89/* simple HD chain data model */
90class CHDChain
91{
92public:
93 uint32_t nExternalChainCounter;
94 uint32_t nInternalChainCounter;
95 CKeyID seed_id; //!< seed hash160
96 int64_t m_next_external_index{0}; // Next index in the keypool to be used. Memory only.
97 int64_t m_next_internal_index{0}; // Next index in the keypool to be used. Memory only.
98
99 static const int VERSION_HD_BASE = 1;
100 static const int VERSION_HD_CHAIN_SPLIT = 2;
101 static const int CURRENT_VERSION = VERSION_HD_CHAIN_SPLIT;
102 int nVersion;
103
104 CHDChain() { SetNull(); }
105
106 SERIALIZE_METHODS(CHDChain, obj)
107 {
108 READWRITE(obj.nVersion, obj.nExternalChainCounter, obj.seed_id);
109 if (obj.nVersion >= VERSION_HD_CHAIN_SPLIT) {
110 READWRITE(obj.nInternalChainCounter);
111 }
112 }
113
114 void SetNull()
115 {
116 nVersion = CHDChain::CURRENT_VERSION;
117 nExternalChainCounter = 0;
118 nInternalChainCounter = 0;
119 seed_id.SetNull();
120 }
121
122 bool operator==(const CHDChain& chain) const
123 {
124 return seed_id == chain.seed_id;
125 }
126};
127
128class CKeyMetadata
129{

Callers 1

walletdb.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected