File tree Expand file tree Collapse file tree 2 files changed +41
-40
lines changed Expand file tree Collapse file tree 2 files changed +41
-40
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,18 @@ bool CCryptoKeyStore::SetCrypted()
153
153
return true ;
154
154
}
155
155
156
+ bool CCryptoKeyStore::IsLocked () const
157
+ {
158
+ if (!IsCrypted ())
159
+ return false ;
160
+ bool result;
161
+ {
162
+ LOCK (cs_KeyStore);
163
+ result = vMasterKey.empty ();
164
+ }
165
+ return result;
166
+ }
167
+
156
168
bool CCryptoKeyStore::Lock ()
157
169
{
158
170
if (!SetCrypted ())
@@ -239,6 +251,18 @@ bool CCryptoKeyStore::AddCryptedKey(const CPubKey &vchPubKey, const std::vector<
239
251
return true ;
240
252
}
241
253
254
+ bool CCryptoKeyStore::HaveKey (const CKeyID &address) const
255
+ {
256
+ {
257
+ LOCK (cs_KeyStore);
258
+ if (!IsCrypted ()) {
259
+ return CBasicKeyStore::HaveKey (address);
260
+ }
261
+ return mapCryptedKeys.count (address) > 0 ;
262
+ }
263
+ return false ;
264
+ }
265
+
242
266
bool CCryptoKeyStore::GetKey (const CKeyID &address, CKey& keyOut) const
243
267
{
244
268
{
@@ -275,6 +299,19 @@ bool CCryptoKeyStore::GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) co
275
299
}
276
300
}
277
301
302
+ std::set<CKeyID> CCryptoKeyStore::GetKeys () const
303
+ {
304
+ LOCK (cs_KeyStore);
305
+ if (!IsCrypted ()) {
306
+ return CBasicKeyStore::GetKeys ();
307
+ }
308
+ std::set<CKeyID> set_address;
309
+ for (const auto & mi : mapCryptedKeys) {
310
+ set_address.insert (mi.first );
311
+ }
312
+ return set_address;
313
+ }
314
+
278
315
bool CCryptoKeyStore::EncryptKeys (CKeyingMaterial& vMasterKeyIn)
279
316
{
280
317
{
Original file line number Diff line number Diff line change @@ -137,52 +137,16 @@ class CCryptoKeyStore : public CBasicKeyStore
137
137
{
138
138
}
139
139
140
- bool IsCrypted () const
141
- {
142
- return fUseCrypto ;
143
- }
144
-
145
- bool IsLocked () const
146
- {
147
- if (!IsCrypted ())
148
- return false ;
149
- bool result;
150
- {
151
- LOCK (cs_KeyStore);
152
- result = vMasterKey.empty ();
153
- }
154
- return result;
155
- }
156
-
140
+ bool IsCrypted () const { return fUseCrypto ; }
141
+ bool IsLocked () const ;
157
142
bool Lock ();
158
143
159
144
virtual bool AddCryptedKey (const CPubKey &vchPubKey, const std::vector<unsigned char > &vchCryptedSecret);
160
145
bool AddKeyPubKey (const CKey& key, const CPubKey &pubkey) override ;
161
- bool HaveKey (const CKeyID &address) const override
162
- {
163
- {
164
- LOCK (cs_KeyStore);
165
- if (!IsCrypted ()) {
166
- return CBasicKeyStore::HaveKey (address);
167
- }
168
- return mapCryptedKeys.count (address) > 0 ;
169
- }
170
- return false ;
171
- }
146
+ bool HaveKey (const CKeyID &address) const override ;
172
147
bool GetKey (const CKeyID &address, CKey& keyOut) const override ;
173
148
bool GetPubKey (const CKeyID &address, CPubKey& vchPubKeyOut) const override ;
174
- std::set<CKeyID> GetKeys () const override
175
- {
176
- LOCK (cs_KeyStore);
177
- if (!IsCrypted ()) {
178
- return CBasicKeyStore::GetKeys ();
179
- }
180
- std::set<CKeyID> set_address;
181
- for (const auto & mi : mapCryptedKeys) {
182
- set_address.insert (mi.first );
183
- }
184
- return set_address;
185
- }
149
+ std::set<CKeyID> GetKeys () const override ;
186
150
187
151
/* *
188
152
* Wallet status (encrypted, locked) changed.
You can’t perform that action at this time.
0 commit comments