Drop CHashWriter

This commit is contained in:
Anthony Towns 2023-09-08 05:18:41 +10:00
parent c94f7e5b1c
commit a0c254c13a
3 changed files with 2 additions and 19 deletions

View File

@ -146,23 +146,6 @@ public:
}
};
class CHashWriter : public HashWriter
{
private:
const int nVersion;
public:
CHashWriter(int nVersionIn) : nVersion{nVersionIn} {}
int GetVersion() const { return nVersion; }
template<typename T>
CHashWriter& operator<<(const T& obj) {
::Serialize(*this, obj);
return (*this);
}
};
/** Reads data from an underlying stream, while hashing the read data. */
template <typename Source>
class HashVerifier : public HashWriter

View File

@ -10,7 +10,7 @@
uint256 CBlockHeader::GetHash() const
{
return (CHashWriter{PROTOCOL_VERSION} << *this).GetHash();
return (HashWriter{} << *this).GetHash();
}
std::string CBlock::ToString() const

View File

@ -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.