aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.h
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-12-08 12:50:46 -0500
committerRussell Yanofsky <russ@yanofsky.org>2017-12-08 12:50:46 -0500
commit9c8eca7704e88b3f4ee38cf85bef0f1febc440e5 (patch)
tree65a5fb461a02112b1e167e3ecfa522cffcdc4414 /src/wallet/wallet.h
parent4ef4dfebbc07d93d72899f60e01ca77a280c9122 (diff)
downloadbitcoin-9c8eca7704e88b3f4ee38cf85bef0f1febc440e5.tar.xz
Split up key and script metadata for better type safety
Suggested by Matt Corallo <git@bluematt.me> https://github.com/bitcoin/bitcoin/pull/11403#discussion_r155599383 Combining the maps was probably never a good arrangement but is more problematic now in presence of WitnessV0ScriptHash and WitnessV0KeyHash types.
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r--src/wallet/wallet.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 1bd0be7bd0..93d1857c7f 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -761,9 +761,11 @@ public:
void LoadKeyPool(int64_t nIndex, const CKeyPool &keypool);
- // Map from Key ID (for regular keys) or Script ID (for watch-only keys) to
- // key metadata.
- std::map<CTxDestination, CKeyMetadata> mapKeyMetadata;
+ // Map from Key ID to key metadata.
+ std::map<CKeyID, CKeyMetadata> mapKeyMetadata;
+
+ // Map from Script ID to key metadata (for watch-only keys).
+ std::map<CScriptID, CKeyMetadata> m_script_metadata;
typedef std::map<unsigned int, CMasterKey> MasterKeyMap;
MasterKeyMap mapMasterKeys;
@@ -874,7 +876,8 @@ public:
//! Adds a key to the store, without saving it to disk (used by LoadWallet)
bool LoadKey(const CKey& key, const CPubKey &pubkey) { return CCryptoKeyStore::AddKeyPubKey(key, pubkey); }
//! Load metadata (used by LoadWallet)
- bool LoadKeyMetadata(const CTxDestination& pubKey, const CKeyMetadata &metadata);
+ bool LoadKeyMetadata(const CKeyID& keyID, const CKeyMetadata &metadata);
+ bool LoadScriptMetadata(const CScriptID& script_id, const CKeyMetadata &metadata);
bool LoadMinVersion(int nVersion) { AssertLockHeld(cs_wallet); nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); return true; }
void UpdateTimeFirstKey(int64_t nCreateTime);