| 368 | } |
| 369 | |
| 370 | void CExtPubKey::Decode(const unsigned char code[BIP32_EXTKEY_SIZE]) { |
| 371 | nDepth = code[0]; |
| 372 | memcpy(vchFingerprint, code+1, 4); |
| 373 | nChild = ReadBE32(code+5); |
| 374 | memcpy(chaincode.begin(), code+9, 32); |
| 375 | pubkey.Set(code+41, code+BIP32_EXTKEY_SIZE); |
| 376 | if ((nDepth == 0 && (nChild != 0 || ReadLE32(vchFingerprint) != 0)) || !pubkey.IsFullyValid()) pubkey = CPubKey(); |
| 377 | } |
| 378 | |
| 379 | void CExtPubKey::EncodeWithVersion(unsigned char code[BIP32_EXTKEY_WITH_VERSION_SIZE]) const |
| 380 | { |