Skip to content

Commit

Permalink
Drop CHashWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtowns committed Nov 8, 2023
1 parent 1570c59 commit d0d4308
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
17 changes: 0 additions & 17 deletions src/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<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
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

uint256 CBlockHeader::GetHash() const
{
return (CHashWriter{PROTOCOL_VERSION} << *this).GetHash();
return (HashWriter{} << *this).GetHash();
}

std::string CBlock::ToString() const
Expand Down
2 changes: 1 addition & 1 deletion src/test/hash_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d0d4308

Please sign in to comment.