aboutsummaryrefslogtreecommitdiff
path: root/src/primitives
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-09-11 15:47:52 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-09-19 16:38:08 +0200
commitfa72f09d6ff8ee204f331a69d3f5e825223c9e11 (patch)
treed45356514481c7a21d7fe4c87681a85bfdd86347 /src/primitives
parentfa4a9c0f4334678fb80358ead667807bf2a0a153 (diff)
downloadbitcoin-fa72f09d6ff8ee204f331a69d3f5e825223c9e11.tar.xz
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.
Diffstat (limited to 'src/primitives')
-rw-r--r--src/primitives/block.cpp2
-rw-r--r--src/primitives/transaction.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp
index 50a30cb511..3d21708820 100644
--- a/src/primitives/block.cpp
+++ b/src/primitives/block.cpp
@@ -10,7 +10,7 @@
uint256 CBlockHeader::GetHash() const
{
- return SerializeHash(*this);
+ return (CHashWriter{PROTOCOL_VERSION} << *this).GetHash();
}
std::string CBlock::ToString() const
diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp
index 3060746909..2c913bf432 100644
--- a/src/primitives/transaction.cpp
+++ b/src/primitives/transaction.cpp
@@ -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()} {}