Refactor GetTxid() into UpdateTxid() to match coding style of hash member variable.

UpdateTxid() is called alongside UpdateHash() when a CTransaction is
deserialized or constructed.  GetTxid() now returns a const reference.
This commit is contained in:
Simon
2016-07-26 17:06:55 -07:00
parent 29306269f4
commit 07e6d5b025
2 changed files with 13 additions and 7 deletions

View File

@@ -288,6 +288,8 @@ private:
/** Memory only. */
const uint256 hash;
void UpdateHash() const;
uint256 txid;
void UpdateTxid() const;
public:
typedef boost::array<unsigned char, 64> joinsplit_sig_t;
@@ -331,8 +333,10 @@ public:
READWRITE(*const_cast<joinsplit_sig_t*>(&joinSplitSig));
}
}
if (ser_action.ForRead())
if (ser_action.ForRead()) {
UpdateHash();
UpdateTxid();
}
}
bool IsNull() const {
@@ -374,9 +378,10 @@ public:
std::string ToString() const;
// Return the txid which is the double SHA256 hash of the transaction.
uint256 GetTxid() 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. */