aboutsummaryrefslogtreecommitdiff
path: root/src/pubkey.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <jonas.schnelli@include7.ch>2015-06-01 16:35:19 +0200
committerJonas Schnelli <dev@jonasschnelli.ch>2016-04-14 20:56:33 +0200
commit90604f16af63ec066d6561337f476ccd8acec326 (patch)
tree5cca6f0af2f22330bbf7d7a913b3e10cbcafe868 /src/pubkey.cpp
parente6a4d48a9bff0bdbcca3a13de59b5e6e683a6aac (diff)
downloadbitcoin-90604f16af63ec066d6561337f476ccd8acec326.tar.xz
add bip32 pubkey serialization
CExtPubKey should be serializable like CPubKey
Diffstat (limited to 'src/pubkey.cpp')
-rw-r--r--src/pubkey.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pubkey.cpp b/src/pubkey.cpp
index db06a89285..be4ee27cd4 100644
--- a/src/pubkey.cpp
+++ b/src/pubkey.cpp
@@ -246,7 +246,7 @@ bool CPubKey::Derive(CPubKey& pubkeyChild, ChainCode &ccChild, unsigned int nChi
return true;
}
-void CExtPubKey::Encode(unsigned char code[74]) const {
+void CExtPubKey::Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const {
code[0] = nDepth;
memcpy(code+1, vchFingerprint, 4);
code[5] = (nChild >> 24) & 0xFF; code[6] = (nChild >> 16) & 0xFF;
@@ -256,12 +256,12 @@ void CExtPubKey::Encode(unsigned char code[74]) const {
memcpy(code+41, pubkey.begin(), 33);
}
-void CExtPubKey::Decode(const unsigned char code[74]) {
+void CExtPubKey::Decode(const unsigned char code[BIP32_EXTKEY_SIZE]) {
nDepth = code[0];
memcpy(vchFingerprint, code+1, 4);
nChild = (code[5] << 24) | (code[6] << 16) | (code[7] << 8) | code[8];
memcpy(chaincode.begin(), code+9, 32);
- pubkey.Set(code+41, code+74);
+ pubkey.Set(code+41, code+BIP32_EXTKEY_SIZE);
}
bool CExtPubKey::Derive(CExtPubKey &out, unsigned int nChild) const {