diff --git a/src/key.h b/src/key.h --- a/src/key.h +++ b/src/key.h @@ -174,23 +174,6 @@ bool Derive(CExtKey &out, unsigned int nChild) const; CExtPubKey Neuter() const; void SetSeed(const uint8_t *seed, unsigned int nSeedLen); - template void Serialize(Stream &s) const { - unsigned int len = BIP32_EXTKEY_SIZE; - ::WriteCompactSize(s, len); - uint8_t code[BIP32_EXTKEY_SIZE]; - Encode(code); - s.write((const char *)&code[0], len); - } - template void Unserialize(Stream &s) { - unsigned int len = ::ReadCompactSize(s); - if (len != BIP32_EXTKEY_SIZE) { - throw std::runtime_error("Invalid extended key size\n"); - } - - uint8_t code[BIP32_EXTKEY_SIZE]; - s.read((char *)&code[0], len); - Decode(code); - } CExtKey() = default; }; diff --git a/src/pubkey.h b/src/pubkey.h --- a/src/pubkey.h +++ b/src/pubkey.h @@ -206,29 +206,6 @@ void Decode(const uint8_t code[BIP32_EXTKEY_SIZE]); bool Derive(CExtPubKey &out, unsigned int nChild) const; - void Serialize(CSizeComputer &s) const { - // Optimized implementation for ::GetSerializeSize that avoids copying. - // add one byte for the size (compact int) - s.seek(BIP32_EXTKEY_SIZE + 1); - } - template void Serialize(Stream &s) const { - unsigned int len = BIP32_EXTKEY_SIZE; - ::WriteCompactSize(s, len); - uint8_t code[BIP32_EXTKEY_SIZE]; - Encode(code); - s.write((const char *)&code[0], len); - } - template void Unserialize(Stream &s) { - unsigned int len = ::ReadCompactSize(s); - if (len != BIP32_EXTKEY_SIZE) { - throw std::runtime_error("Invalid extended key size\n"); - } - - uint8_t code[BIP32_EXTKEY_SIZE]; - s.read((char *)&code[0], len); - Decode(code); - } - CExtPubKey() = default; }; diff --git a/src/test/bip32_tests.cpp b/src/test/bip32_tests.cpp --- a/src/test/bip32_tests.cpp +++ b/src/test/bip32_tests.cpp @@ -125,22 +125,6 @@ } key = keyNew; pubkey = pubkeyNew; - - CDataStream ssPub(SER_DISK, CLIENT_VERSION); - ssPub << pubkeyNew; - BOOST_CHECK(ssPub.size() == 75); - - CDataStream ssPriv(SER_DISK, CLIENT_VERSION); - ssPriv << keyNew; - BOOST_CHECK(ssPriv.size() == 75); - - CExtPubKey pubCheck; - CExtKey privCheck; - ssPub >> pubCheck; - ssPriv >> privCheck; - - BOOST_CHECK(pubCheck == pubkeyNew); - BOOST_CHECK(privCheck == keyNew); } }