Remove #1144 from transaction.h.

Reverts to 4bc00dc with commits f0dab51 (snark) and f5e5707 (joinsplit) retained.
GetTxid() is now an alias for GetHash().
This commit is contained in:
Simon 2016-08-27 13:54:21 -07:00
parent 02932fc9cc
commit 82f3c490b1
1 changed files with 16 additions and 13 deletions

View File

@ -290,8 +290,6 @@ private:
/** Memory only. */ /** Memory only. */
const uint256 hash; const uint256 hash;
void UpdateHash() const; void UpdateHash() const;
const uint256 txid;
void UpdateTxid() const;
public: public:
typedef boost::array<unsigned char, 64> joinsplit_sig_t; typedef boost::array<unsigned char, 64> joinsplit_sig_t;
@ -335,16 +333,22 @@ public:
READWRITE(*const_cast<joinsplit_sig_t*>(&joinSplitSig)); READWRITE(*const_cast<joinsplit_sig_t*>(&joinSplitSig));
} }
} }
if (ser_action.ForRead()) { if (ser_action.ForRead())
UpdateHash(); UpdateHash();
UpdateTxid();
}
} }
bool IsNull() const { bool IsNull() const {
return vin.empty() && vout.empty(); return vin.empty() && vout.empty();
} }
const uint256& GetHash() const {
return hash;
}
const uint256& GetTxid() const {
return hash;
}
// Return sum of txouts. // Return sum of txouts.
CAmount GetValueOut() const; CAmount GetValueOut() const;
// GetValueIn() is a method on CCoinsViewCache, because // GetValueIn() is a method on CCoinsViewCache, because
@ -375,11 +379,6 @@ public:
} }
std::string ToString() const; 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. */ /** A mutable version of CTransaction. */
@ -414,10 +413,14 @@ struct CMutableTransaction
} }
} }
/** Compute the non-malleable txid of this CMutableTransaction. This is computed on the /** Compute the hash of this CMutableTransaction. This is computed on the
* fly, as opposed to GetTxid() in CTransaction, which uses a cached result. * 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 #endif // BITCOIN_PRIMITIVES_TRANSACTION_H