Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/scriptpubkeyman.h
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | public: | ||||
bool fInternal; | bool fInternal; | ||||
//! Whether this key was generated for a keypool before the wallet was | //! Whether this key was generated for a keypool before the wallet was | ||||
//! upgraded to HD-split | //! upgraded to HD-split | ||||
bool m_pre_split; | bool m_pre_split; | ||||
CKeyPool(); | CKeyPool(); | ||||
CKeyPool(const CPubKey &vchPubKeyIn, bool internalIn); | CKeyPool(const CPubKey &vchPubKeyIn, bool internalIn); | ||||
ADD_SERIALIZE_METHODS; | template <typename Stream> void Serialize(Stream &s) const { | ||||
template <typename Stream, typename Operation> | |||||
inline void SerializationOp(Stream &s, Operation ser_action) { | |||||
int nVersion = s.GetVersion(); | int nVersion = s.GetVersion(); | ||||
if (!(s.GetType() & SER_GETHASH)) { | if (!(s.GetType() & SER_GETHASH)) { | ||||
READWRITE(nVersion); | s << nVersion; | ||||
} | |||||
s << nTime << vchPubKey << fInternal << m_pre_split; | |||||
} | } | ||||
READWRITE(nTime); | template <typename Stream> void Unserialize(Stream &s) { | ||||
READWRITE(vchPubKey); | int nVersion = s.GetVersion(); | ||||
if (ser_action.ForRead()) { | if (!(s.GetType() & SER_GETHASH)) { | ||||
s >> nVersion; | |||||
} | |||||
s >> nTime >> vchPubKey; | |||||
try { | try { | ||||
READWRITE(fInternal); | s >> fInternal; | ||||
} catch (std::ios_base::failure &) { | } catch (std::ios_base::failure &) { | ||||
/** | /** | ||||
* flag as external address if we can't read the internal | * flag as external address if we can't read the internal | ||||
* boolean (this will be the case for any wallet before the HD | * boolean (this will be the case for any wallet before the HD | ||||
* chain split version) | * chain split version) | ||||
*/ | */ | ||||
fInternal = false; | fInternal = false; | ||||
} | } | ||||
try { | try { | ||||
READWRITE(m_pre_split); | s >> m_pre_split; | ||||
} catch (std::ios_base::failure &) { | } catch (std::ios_base::failure &) { | ||||
/** | /** | ||||
* flag as postsplit address if we can't read the m_pre_split | * flag as postsplit address if we can't read the m_pre_split | ||||
* 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; | ||||
} | } | ||||
} else { | |||||
READWRITE(fInternal); | |||||
READWRITE(m_pre_split); | |||||
} | |||||
} | } | ||||
}; | }; | ||||
class KeyIDHasher { | class KeyIDHasher { | ||||
public: | public: | ||||
KeyIDHasher() {} | KeyIDHasher() {} | ||||
size_t operator()(const CKeyID &id) const { return id.GetUint64(0); } | size_t operator()(const CKeyID &id) const { return id.GetUint64(0); } | ||||
▲ Show 20 Lines • Show All 624 Lines • Show Last 20 Lines |