mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
Remove unused legacy CHashVerifier
This commit is contained in:
parent
fafa3fc5a6
commit
fa626af3ed
2 changed files with 2 additions and 35 deletions
33
src/hash.h
33
src/hash.h
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue