[Wallet] extend CKeyMetadata with HD keypath
Zcash: modified for zip32
This commit is contained in:
committed by
Eirik Ogilvie-Wigley
parent
9bcf90e2de
commit
b6d1af89f2
@@ -77,9 +77,13 @@ public:
|
||||
class CKeyMetadata
|
||||
{
|
||||
public:
|
||||
static const int CURRENT_VERSION=1;
|
||||
static const int VERSION_BASIC=1;
|
||||
static const int VERSION_WITH_HDDATA=10;
|
||||
static const int CURRENT_VERSION=VERSION_WITH_HDDATA;
|
||||
int nVersion;
|
||||
int64_t nCreateTime; // 0 means unknown
|
||||
std::string hdKeypath; //optional HD/zip32 keypath
|
||||
uint256 seedFp;
|
||||
|
||||
CKeyMetadata()
|
||||
{
|
||||
@@ -89,6 +93,7 @@ public:
|
||||
{
|
||||
nVersion = CKeyMetadata::CURRENT_VERSION;
|
||||
nCreateTime = nCreateTime_;
|
||||
hdKeypath.clear();
|
||||
}
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
@@ -97,12 +102,18 @@ public:
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
READWRITE(this->nVersion);
|
||||
READWRITE(nCreateTime);
|
||||
if (this->nVersion >= VERSION_WITH_HDDATA)
|
||||
{
|
||||
READWRITE(hdKeypath);
|
||||
READWRITE(seedFp);
|
||||
}
|
||||
}
|
||||
|
||||
void SetNull()
|
||||
{
|
||||
nVersion = CKeyMetadata::CURRENT_VERSION;
|
||||
nCreateTime = 0;
|
||||
hdKeypath.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user