mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-19 00:11:42 +02:00
Drop CHashWriter
This commit is contained in:
parent
c94f7e5b1c
commit
a0c254c13a
17
src/hash.h
17
src/hash.h
@ -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. */
|
/** Reads data from an underlying stream, while hashing the read data. */
|
||||||
template <typename Source>
|
template <typename Source>
|
||||||
class HashVerifier : public HashWriter
|
class HashVerifier : public HashWriter
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
uint256 CBlockHeader::GetHash() const
|
uint256 CBlockHeader::GetHash() const
|
||||||
{
|
{
|
||||||
return (CHashWriter{PROTOCOL_VERSION} << *this).GetHash();
|
return (HashWriter{} << *this).GetHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CBlock::ToString() const
|
std::string CBlock::ToString() const
|
||||||
|
@ -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));
|
(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;
|
CMutableTransaction tx;
|
||||||
// Note these tests were originally written with tx.nVersion=1
|
// Note these tests were originally written with tx.nVersion=1
|
||||||
// and the test would be affected by default tx version bumps if not fixed.
|
// and the test would be affected by default tx version bumps if not fixed.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user