Remove unused legacy CHashVerifier

This commit is contained in:
MarcoFalke 2023-08-25 18:10:53 +02:00
parent fafa3fc5a6
commit fa626af3ed
No known key found for this signature in database
2 changed files with 2 additions and 35 deletions

View file

@ -199,39 +199,6 @@ public:
}
};
template<typename Source>
class CHashVerifier : public CHashWriter
{
private:
Source* source;
public:
explicit CHashVerifier(Source* source_) : CHashWriter(source_->GetType(), source_->GetVersion()), source(source_) {}
void read(Span<std::byte> dst)
{
source->read(dst);
this->write(dst);
}
void ignore(size_t nSize)
{
std::byte data[1024];
while (nSize > 0) {
size_t now = std::min<size_t>(nSize, 1024);
read({data, now});
nSize -= now;
}
}
template<typename T>
CHashVerifier<Source>& operator>>(T&& obj)
{
::Unserialize(*this, obj);
return (*this);
}
};
/** Writes data to an underlying source stream, while hashing the written data. */
template <typename Source>
class HashedSourceWriter : public HashWriter

View file

@ -553,12 +553,12 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file_rand)
BOOST_AUTO_TEST_CASE(streams_hashed)
{
CDataStream stream(SER_NETWORK, INIT_PROTO_VERSION);
DataStream stream{};
HashedSourceWriter hash_writer{stream};
const std::string data{"bitcoin"};
hash_writer << data;
CHashVerifier hash_verifier{&stream};
HashVerifier hash_verifier{stream};
std::string result;
hash_verifier >> result;
BOOST_CHECK_EQUAL(data, result);