diff --git a/src/hdchain.cpp b/src/hdchain.cpp index 358b754132..8865ad4f80 100644 --- a/src/hdchain.cpp +++ b/src/hdchain.cpp @@ -8,9 +8,6 @@ #include #include #include -#ifdef ENABLE_WALLET -#include -#endif bool CHDChain::SetNull() { @@ -159,7 +156,7 @@ uint256 CHDChain::GetSeedHash() return Hash(vchSeed.begin(), vchSeed.end()); } -void CHDChain::DeriveChildExtKey(uint32_t nAccountIndex, bool fInternal, uint32_t nChildIndex, CExtKey& extKeyRet, CKeyMetadata& metadata) +void CHDChain::DeriveChildExtKey(uint32_t nAccountIndex, bool fInternal, uint32_t nChildIndex, CExtKey& extKeyRet, KeyOriginInfo& key_origin) { LOCK(cs); // Use BIP44 keypath scheme i.e. m / purpose' / coin_type' / account' / change / address_index @@ -188,17 +185,15 @@ void CHDChain::DeriveChildExtKey(uint32_t nAccountIndex, bool fInternal, uint32_ #ifdef ENABLE_WALLET // We should never ever update an already existing key_origin here - assert(!metadata.has_key_origin); - assert(metadata.key_origin.path.empty()); - metadata.key_origin.path.push_back(44 | 0x80000000); - metadata.key_origin.path.push_back(Params().ExtCoinType() | 0x80000000); - metadata.key_origin.path.push_back(nAccountIndex | 0x80000000); - metadata.key_origin.path.push_back(fInternal ? 1 : 0); - metadata.key_origin.path.push_back(nChildIndex); + assert(key_origin.path.empty()); + key_origin.path.push_back(44 | 0x80000000); + key_origin.path.push_back(Params().ExtCoinType() | 0x80000000); + key_origin.path.push_back(nAccountIndex | 0x80000000); + key_origin.path.push_back(fInternal ? 1 : 0); + key_origin.path.push_back(nChildIndex); CKeyID master_id = masterKey.key.GetPubKey().GetID(); - std::copy(master_id.begin(), master_id.begin() + 4, metadata.key_origin.fingerprint); - metadata.has_key_origin = true; + std::copy(master_id.begin(), master_id.begin() + 4, key_origin.fingerprint); #endif } diff --git a/src/hdchain.h b/src/hdchain.h index 388d464b0b..4d2b60486a 100644 --- a/src/hdchain.h +++ b/src/hdchain.h @@ -4,10 +4,9 @@ #define BITCOIN_HDCHAIN_H #include +#include