Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/scriptpubkeyman.h
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | template <typename Stream> void Unserialize(Stream &s) { | ||||
* boolean (this will be the case for any wallet that upgrades | * boolean (this will be the case for any wallet that upgrades | ||||
* to HD chain split) | * to HD chain split) | ||||
*/ | */ | ||||
m_pre_split = false; | m_pre_split = false; | ||||
} | } | ||||
} | } | ||||
}; | }; | ||||
class KeyIDHasher { | |||||
public: | |||||
KeyIDHasher() {} | |||||
size_t operator()(const CKeyID &id) const { return id.GetUint64(0); } | |||||
}; | |||||
/** | /** | ||||
* A class implementing ScriptPubKeyMan manages some (or all) scriptPubKeys used | * A class implementing ScriptPubKeyMan manages some (or all) scriptPubKeys used | ||||
* in a wallet. It contains the scripts and keys related to the scriptPubKeys it | * in a wallet. It contains the scripts and keys related to the scriptPubKeys it | ||||
* manages. A ScriptPubKeyMan will be able to give out scriptPubKeys to be used, | * manages. A ScriptPubKeyMan will be able to give out scriptPubKeys to be used, | ||||
* as well as marking when a scriptPubKey has been used. It also handles when | * as well as marking when a scriptPubKey has been used. It also handles when | ||||
* and how to store a scriptPubKey and its related scripts and keys, including | * and how to store a scriptPubKey and its related scripts and keys, including | ||||
* encryption. | * encryption. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | private: | ||||
bool AddCScriptWithDB(WalletBatch &batch, const CScript &script); | bool AddCScriptWithDB(WalletBatch &batch, const CScript &script); | ||||
/** Add a KeyOriginInfo to the wallet */ | /** Add a KeyOriginInfo to the wallet */ | ||||
bool AddKeyOriginWithDB(WalletBatch &batch, const CPubKey &pubkey, | bool AddKeyOriginWithDB(WalletBatch &batch, const CPubKey &pubkey, | ||||
const KeyOriginInfo &info); | const KeyOriginInfo &info); | ||||
/* the HD chain data model (external chain counters) */ | /* the HD chain data model (external chain counters) */ | ||||
CHDChain m_hd_chain; | CHDChain m_hd_chain; | ||||
std::unordered_map<CKeyID, CHDChain, KeyIDHasher> m_inactive_hd_chains; | std::unordered_map<CKeyID, CHDChain, SaltedSipHasher> m_inactive_hd_chains; | ||||
/* HD derive new child key (on internal or external chain) */ | /* HD derive new child key (on internal or external chain) */ | ||||
void DeriveNewChildKey(WalletBatch &batch, CKeyMetadata &metadata, | void DeriveNewChildKey(WalletBatch &batch, CKeyMetadata &metadata, | ||||
CKey &secret, CHDChain &hd_chain, | CKey &secret, CHDChain &hd_chain, | ||||
bool internal = false) | bool internal = false) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore); | EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore); | ||||
std::set<int64_t> setInternalKeyPool GUARDED_BY(cs_KeyStore); | std::set<int64_t> setInternalKeyPool GUARDED_BY(cs_KeyStore); | ||||
▲ Show 20 Lines • Show All 401 Lines • Show Last 20 Lines |