From 1e84d84d3ab26151192221f4fb2fd145a2a95bc0 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 25 Jul 2016 11:25:00 -0700 Subject: [PATCH] Rename GetHash() method to GetSerializeHash(). When pulling from upstream we are now forced to examine GetHash() usage and replace with GetSerializeHash() if the caller wants a double SHA256 hash, or with GetTxid() if the caller wants a transaction id. --- src/primitives/transaction.cpp | 9 +++++---- src/primitives/transaction.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index 510e0b5c5..393215207 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -116,7 +116,7 @@ CMutableTransaction::CMutableTransaction(const CTransaction& tx) : nVersion(tx.n } -uint256 CMutableTransaction::GetHash() const +uint256 CMutableTransaction::GetSerializeHash() const { return SerializeHash(*this); } @@ -211,8 +211,9 @@ unsigned int CTransaction::CalculateModifiedSize(unsigned int nTxSize) const std::string CTransaction::ToString() const { std::string str; - str += strprintf("CTransaction(hash=%s, ver=%d, vin.size=%u, vout.size=%u, nLockTime=%u)\n", - GetHash().ToString().substr(0,10), + str += strprintf("CTransaction(txid=%s, hash=%s, ver=%d, vin.size=%u, vout.size=%u, nLockTime=%u)\n", + GetTxid().ToString().substr(0,10), + GetSerializeHash().ToString().substr(0,10), nVersion, vin.size(), vout.size(), @@ -240,7 +241,7 @@ uint256 CTransaction::GetTxid() const tx.joinSplitSig.assign(0); // Return double SHA256 hash - return tx.GetHash(); + return tx.GetSerializeHash(); } diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 0009fcf44..ed11e5c30 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -339,7 +339,7 @@ public: return vin.empty() && vout.empty(); } - const uint256& GetHash() const { + const uint256& GetSerializeHash() const { return hash; } @@ -414,7 +414,7 @@ struct CMutableTransaction /** Compute the hash of this CMutableTransaction. This is computed on the * fly, as opposed to GetHash() in CTransaction, which uses a cached result. */ - uint256 GetHash() const; + uint256 GetSerializeHash() const; // Compute a non-malleable txid on the fly. uint256 GetTxid() const;