Skip to content

Commit d0b9405

Browse files
committed
Refactors keystore.h type aliases.
This squashed commit either encapsulates type alias declarations at the appropriate scope; or removes type aliases that are not used. The encapsulated type aliases are declared using C++11's `using` notation in favor of the `typedef` notation.
1 parent 5ba77df commit d0b9405

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/keystore.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ class CKeyStore : public SigningProvider
3838
virtual bool HaveWatchOnly() const =0;
3939
};
4040

41-
typedef std::map<CKeyID, CKey> KeyMap;
42-
typedef std::map<CKeyID, CPubKey> WatchKeyMap;
43-
typedef std::map<CScriptID, CScript > ScriptMap;
44-
typedef std::set<CScript> WatchOnlySet;
45-
4641
/** Basic key store, that keeps keys in an address->secret map */
4742
class CBasicKeyStore : public CKeyStore
4843
{
4944
protected:
5045
mutable CCriticalSection cs_KeyStore;
5146

47+
using KeyMap = std::map<CKeyID, CKey>;
48+
using WatchKeyMap = std::map<CKeyID, CPubKey>;
49+
using ScriptMap = std::map<CScriptID, CScript>;
50+
using WatchOnlySet = std::set<CScript>;
51+
5252
KeyMap mapKeys GUARDED_BY(cs_KeyStore);
5353
WatchKeyMap mapWatchKeys GUARDED_BY(cs_KeyStore);
5454
ScriptMap mapScripts GUARDED_BY(cs_KeyStore);
@@ -74,9 +74,6 @@ class CBasicKeyStore : public CKeyStore
7474
bool HaveWatchOnly() const override;
7575
};
7676

77-
typedef std::vector<unsigned char, secure_allocator<unsigned char> > CKeyingMaterial;
78-
typedef std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char> > > CryptedKeyMap;
79-
8077
/** Return the CKeyID of the key involved in a script (if there is a unique one). */
8178
CKeyID GetKeyForDestination(const CKeyStore& store, const CTxDestination& dest);
8279

src/wallet/crypter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ class CCryptoKeyStore : public CBasicKeyStore
126126
bool fDecryptionThoroughlyChecked;
127127

128128
protected:
129+
using CryptedKeyMap = std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char>>>;
130+
129131
bool SetCrypted();
130132

131133
//! will encrypt previously unencrypted keys

0 commit comments

Comments
 (0)