mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
partial Merge #17212: refactor: Remove unused CExt{Pub,}Key (de)serialization methods
5b44a75493a1a098404d5e21dc384e74eae1892e refactor: Remove unused CExt{Pub,}Key (de)serialization methods (Sebastian Falbesoner)
Pull request description:
As pointed out in issue #17130, the serialization/deserialization methods for the classes `CExtKey` and
`CExtPubKey` are only used in the BIP32 unit tests and hence can be removed (see comments https://github.com/bitcoin/bitcoin/issues/17130#issuecomment-543750290, https://github.com/bitcoin/bitcoin/issues/17130#issuecomment-543794408 and https://github.com/bitcoin/bitcoin/issues/17130#issuecomment-543814727).
ACKs for top commit:
practicalswift:
ACK 5b44a75493a1a098404d5e21dc384e74eae1892e -- -60 LOC diff looks correct :)
promag:
ACK 5b44a75493a1a098404d5e21dc384e74eae1892e.
MarcoFalke:
unsigned ACK 5b44a75493a1a098404d5e21dc384e74eae1892e
fjahr:
ACK 5b44a75
jonatack:
Light ACK 5b44a75493a1a098404d5e21dc384e74eae1892e. Built, ran tests and bitcoind. `git blame` shows most of the last changes are from commit 90604f16af
in 2015 to add bip32 pubkey serialization.
Tree-SHA512: 6887573b76b9e54e117a076557407b6f7908719b2202fb9eea498522baf9f30198b3f78b87a62efcd17ad1ab0886196f099239992ce7cbbaee79979ffe9e5f2c
This commit is contained in:
parent
27ecb07c8a
commit
e2d1171423
19
src/key.h
19
src/key.h
@ -161,25 +161,6 @@ struct CExtKey {
|
||||
bool Derive(CExtKey& out, unsigned int nChild) const;
|
||||
CExtPubKey Neuter() const;
|
||||
void SetSeed(const unsigned char* seed, unsigned int nSeedLen);
|
||||
template <typename Stream>
|
||||
void Serialize(Stream& s) const
|
||||
{
|
||||
unsigned int len = BIP32_EXTKEY_SIZE;
|
||||
::WriteCompactSize(s, len);
|
||||
unsigned char code[BIP32_EXTKEY_SIZE];
|
||||
Encode(code);
|
||||
s.write((const char *)&code[0], len);
|
||||
}
|
||||
template <typename Stream>
|
||||
void Unserialize(Stream& s)
|
||||
{
|
||||
unsigned int len = ::ReadCompactSize(s);
|
||||
unsigned char code[BIP32_EXTKEY_SIZE];
|
||||
if (len != BIP32_EXTKEY_SIZE)
|
||||
throw std::runtime_error("Invalid extended key size\n");
|
||||
s.read((char *)&code[0], len);
|
||||
Decode(code);
|
||||
}
|
||||
};
|
||||
|
||||
/** Initialize the elliptic curve support. May not be called twice without calling ECC_Stop first. */
|
||||
|
@ -118,22 +118,6 @@ static void RunTest(const TestVector &test) {
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user