From d0d4308750c14c44ed2a9b60bb44d6ec5423bd5a Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Fri, 8 Sep 2023 05:18:41 +1000 Subject: [PATCH] Drop CHashWriter --- src/hash.h | 17 ----------------- src/primitives/block.cpp | 2 +- src/test/hash_tests.cpp | 2 +- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/hash.h b/src/hash.h index d355b703ff4a32..132e1a9fb3983e 100644 --- a/src/hash.h +++ b/src/hash.h @@ -146,23 +146,6 @@ class HashWriter } }; -class CHashWriter : public HashWriter -{ -private: - const int nVersion; - -public: - CHashWriter(int nVersionIn) : nVersion{nVersionIn} {} - - int GetVersion() const { return nVersion; } - - template - CHashWriter& operator<<(const T& obj) { - ::Serialize(*this, obj); - return (*this); - } -}; - /** Reads data from an underlying stream, while hashing the read data. */ template class HashVerifier : public HashWriter diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp index 3d217088203718..27da161e1e5a13 100644 --- a/src/primitives/block.cpp +++ b/src/primitives/block.cpp @@ -10,7 +10,7 @@ uint256 CBlockHeader::GetHash() const { - return (CHashWriter{PROTOCOL_VERSION} << *this).GetHash(); + return (HashWriter{} << *this).GetHash(); } std::string CBlock::ToString() const diff --git a/src/test/hash_tests.cpp b/src/test/hash_tests.cpp index d2ef6a4cbd63e3..f0d2b9ed728601 100644 --- a/src/test/hash_tests.cpp +++ b/src/test/hash_tests.cpp @@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE(siphash) (uint64_t(x+4)<<32)|(uint64_t(x+5)<<40)|(uint64_t(x+6)<<48)|(uint64_t(x+7)<<56)); } - CHashWriter ss{CLIENT_VERSION}; + HashWriter ss{}; CMutableTransaction tx; // Note these tests were originally written with tx.nVersion=1 // and the test would be affected by default tx version bumps if not fixed.