mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge bitcoin/bitcoin#28508: refactor: Remove SER_GETHASH, hard-code client version in CKeyPool serialize
fac29a0ab1Remove SER_GETHASH, hard-code client version in CKeyPool serialize (MarcoFalke)fa72f09d6fRemove CHashWriter type (MarcoFalke)fa4a9c0f43Remove unused GetType() from OverrideStream, CVectorWriter, SpanReader (MarcoFalke) Pull request description: Removes a bunch of redundant, dead or duplicate code. Uses the idea from and finishes the idea https://github.com/bitcoin/bitcoin/pull/28428 by theuni ACKs for top commit: ajtowns: ACKfac29a0ab1kevkevinpal: added one nit but otherwise ACK [fac29a0](fac29a0ab1) Tree-SHA512: cc805e2f38e73869a6691fdb5da09fa48524506b87fc93f05d32c336ad3033425a2d7608e317decd3141fde3f084403b8de280396c0c39132336fe0f7510af9e
This commit is contained in:
@@ -123,20 +123,14 @@ public:
|
||||
template<typename Stream>
|
||||
void Serialize(Stream& s) const
|
||||
{
|
||||
int nVersion = s.GetVersion();
|
||||
if (!(s.GetType() & SER_GETHASH)) {
|
||||
s << nVersion;
|
||||
}
|
||||
s << int{259900}; // Unused field, writes the highest client version ever written
|
||||
s << nTime << vchPubKey << fInternal << m_pre_split;
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Unserialize(Stream& s)
|
||||
{
|
||||
int nVersion = s.GetVersion();
|
||||
if (!(s.GetType() & SER_GETHASH)) {
|
||||
s >> nVersion;
|
||||
}
|
||||
s >> int{}; // Discard unused field
|
||||
s >> nTime >> vchPubKey;
|
||||
try {
|
||||
s >> fInternal;
|
||||
|
||||
@@ -752,14 +752,14 @@ bool malformed_descriptor(std::ios_base::failure e)
|
||||
BOOST_FIXTURE_TEST_CASE(wallet_descriptor_test, BasicTestingSetup)
|
||||
{
|
||||
std::vector<unsigned char> malformed_record;
|
||||
CVectorWriter vw(0, 0, malformed_record, 0);
|
||||
CVectorWriter vw{0, malformed_record, 0};
|
||||
vw << std::string("notadescriptor");
|
||||
vw << uint64_t{0};
|
||||
vw << int32_t{0};
|
||||
vw << int32_t{0};
|
||||
vw << int32_t{1};
|
||||
|
||||
SpanReader vr{0, 0, malformed_record};
|
||||
SpanReader vr{0, malformed_record};
|
||||
WalletDescriptor w_desc;
|
||||
BOOST_CHECK_EXCEPTION(vr >> w_desc, std::ios_base::failure, malformed_descriptor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user