mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-30 08:49:29 +02:00
Remove CHashWriter type
The type is only ever set, but never read via GetType(), so remove it. Also, remove SerializeHash to avoid silent merge conflicts and use the already existing GetHash() boilerplate consistently.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
uint256 CBlockHeader::GetHash() const
|
||||
{
|
||||
return SerializeHash(*this);
|
||||
return (CHashWriter{PROTOCOL_VERSION} << *this).GetHash();
|
||||
}
|
||||
|
||||
std::string CBlock::ToString() const
|
||||
|
||||
@@ -67,12 +67,12 @@ CMutableTransaction::CMutableTransaction(const CTransaction& tx) : vin(tx.vin),
|
||||
|
||||
uint256 CMutableTransaction::GetHash() const
|
||||
{
|
||||
return SerializeHash(*this, SER_GETHASH, SERIALIZE_TRANSACTION_NO_WITNESS);
|
||||
return (CHashWriter{SERIALIZE_TRANSACTION_NO_WITNESS} << *this).GetHash();
|
||||
}
|
||||
|
||||
uint256 CTransaction::ComputeHash() const
|
||||
{
|
||||
return SerializeHash(*this, SER_GETHASH, SERIALIZE_TRANSACTION_NO_WITNESS);
|
||||
return (CHashWriter{SERIALIZE_TRANSACTION_NO_WITNESS} << *this).GetHash();
|
||||
}
|
||||
|
||||
uint256 CTransaction::ComputeWitnessHash() const
|
||||
@@ -80,7 +80,7 @@ uint256 CTransaction::ComputeWitnessHash() const
|
||||
if (!HasWitness()) {
|
||||
return hash;
|
||||
}
|
||||
return SerializeHash(*this, SER_GETHASH, 0);
|
||||
return (CHashWriter{0} << *this).GetHash();
|
||||
}
|
||||
|
||||
CTransaction::CTransaction(const CMutableTransaction& tx) : vin(tx.vin), vout(tx.vout), nVersion(tx.nVersion), nLockTime(tx.nLockTime), hash{ComputeHash()}, m_witness_hash{ComputeWitnessHash()} {}
|
||||
|
||||
Reference in New Issue
Block a user