From 82f3c490b13d8da1679a5cda5b82eb69fd276bbe Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 27 Aug 2016 13:54:21 -0700 Subject: [PATCH] Remove #1144 from transaction.h. Reverts to 4bc00dc with commits f0dab51 (snark) and f5e5707 (joinsplit) retained. GetTxid() is now an alias for GetHash(). --- src/primitives/transaction.h | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 44375fc63..952242aca 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -290,8 +290,6 @@ private: /** Memory only. */ const uint256 hash; void UpdateHash() const; - const uint256 txid; - void UpdateTxid() const; public: typedef boost::array joinsplit_sig_t; @@ -335,16 +333,22 @@ public: READWRITE(*const_cast(&joinSplitSig)); } } - if (ser_action.ForRead()) { + if (ser_action.ForRead()) UpdateHash(); - UpdateTxid(); - } } bool IsNull() const { return vin.empty() && vout.empty(); } + const uint256& GetHash() const { + return hash; + } + + const uint256& GetTxid() const { + return hash; + } + // Return sum of txouts. CAmount GetValueOut() const; // GetValueIn() is a method on CCoinsViewCache, because @@ -375,11 +379,6 @@ public: } std::string ToString() const; - - // Return the txid, which is the double SHA256 hash over portions of the transaction. - const uint256& GetTxid() const { - return txid; - } }; /** A mutable version of CTransaction. */ @@ -414,10 +413,14 @@ struct CMutableTransaction } } - /** Compute the non-malleable txid of this CMutableTransaction. This is computed on the - * fly, as opposed to GetTxid() in CTransaction, which uses a cached result. + /** Compute the hash of this CMutableTransaction. This is computed on the + * fly, as opposed to GetHash() in CTransaction, which uses a cached result. */ - uint256 GetTxid() const; + uint256 GetHash() const; + + uint256 GetTxid() const { + return GetHash(); + } }; #endif // BITCOIN_PRIMITIVES_TRANSACTION_H