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

Class CKeyMetadata

src/wallet/walletdb.h:128–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126};
127
128class CKeyMetadata
129{
130public:
131 static const int VERSION_BASIC=1;
132 static const int VERSION_WITH_HDDATA=10;
133 static const int VERSION_WITH_KEY_ORIGIN = 12;
134 static const int CURRENT_VERSION=VERSION_WITH_KEY_ORIGIN;
135 int nVersion;
136 int64_t nCreateTime; // 0 means unknown
137 std::string hdKeypath; //optional HD/bip32 keypath. Still used to determine whether a key is a seed. Also kept for backwards compatibility
138 CKeyID hd_seed_id; //id of the HD seed used to derive this key
139 KeyOriginInfo key_origin; // Key origin info with path and fingerprint
140 bool has_key_origin = false; //!< Whether the key_origin is useful
141
142 CKeyMetadata()
143 {
144 SetNull();
145 }
146 explicit CKeyMetadata(int64_t nCreateTime_)
147 {
148 SetNull();
149 nCreateTime = nCreateTime_;
150 }
151
152 SERIALIZE_METHODS(CKeyMetadata, obj)
153 {
154 READWRITE(obj.nVersion, obj.nCreateTime);
155 if (obj.nVersion >= VERSION_WITH_HDDATA) {
156 READWRITE(obj.hdKeypath, obj.hd_seed_id);
157 }
158 if (obj.nVersion >= VERSION_WITH_KEY_ORIGIN)
159 {
160 READWRITE(obj.key_origin);
161 READWRITE(obj.has_key_origin);
162 }
163 }
164
165 void SetNull()
166 {
167 nVersion = CKeyMetadata::CURRENT_VERSION;
168 nCreateTime = 0;
169 hdKeypath.clear();
170 hd_seed_id.SetNull();
171 key_origin.clear();
172 has_key_origin = false;
173 }
174};
175
176/** Access to the wallet database.
177 * Opens the database and provides read and write access to it. Each read and write is its own transaction.

Callers 1

LoadKeyPoolMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected