mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 23:07:59 +01:00
key: Add constructor for CExtKey that takes CExtPubKey and CKey
We often need to construct a CExtKey given an CExtPubKey and CKey, so implement a constructor that does that for us.
This commit is contained in:
parent
45b2a91897
commit
ef6745879d
1 changed files with 6 additions and 0 deletions
|
@ -223,6 +223,12 @@ struct CExtKey {
|
|||
a.key == b.key;
|
||||
}
|
||||
|
||||
CExtKey() = default;
|
||||
CExtKey(const CExtPubKey& xpub, const CKey& key_in) : nDepth(xpub.nDepth), nChild(xpub.nChild), chaincode(xpub.chaincode), key(key_in)
|
||||
{
|
||||
std::copy(xpub.vchFingerprint, xpub.vchFingerprint + sizeof(xpub.vchFingerprint), vchFingerprint);
|
||||
}
|
||||
|
||||
void Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const;
|
||||
void Decode(const unsigned char code[BIP32_EXTKEY_SIZE]);
|
||||
[[nodiscard]] bool Derive(CExtKey& out, unsigned int nChild) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue