mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-14 06:32:33 +01:00
Store version bytes and be able to serialize them in CExtPubKey
CExtPubKey does not store the version bytes for the extended public key. We store these so that a CExtPubKey can be serialized and deserialized with the same version bytes.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include <vector>
|
||||
|
||||
const unsigned int BIP32_EXTKEY_SIZE = 74;
|
||||
const unsigned int BIP32_EXTKEY_WITH_VERSION_SIZE = 78;
|
||||
|
||||
/** A reference to a CKey: the Hash160 of its serialized public key */
|
||||
class CKeyID : public uint160
|
||||
@@ -283,6 +284,7 @@ public:
|
||||
};
|
||||
|
||||
struct CExtPubKey {
|
||||
unsigned char version[4];
|
||||
unsigned char nDepth;
|
||||
unsigned char vchFingerprint[4];
|
||||
unsigned int nChild;
|
||||
@@ -305,6 +307,8 @@ struct CExtPubKey {
|
||||
|
||||
void Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const;
|
||||
void Decode(const unsigned char code[BIP32_EXTKEY_SIZE]);
|
||||
void EncodeWithVersion(unsigned char code[BIP32_EXTKEY_WITH_VERSION_SIZE]) const;
|
||||
void DecodeWithVersion(const unsigned char code[BIP32_EXTKEY_WITH_VERSION_SIZE]);
|
||||
bool Derive(CExtPubKey& out, unsigned int nChild) const;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user