@@ -67,18 +67,18 @@ uint256 CTransaction::ComputeHash() const
67
67
return SerializeHash (*this , SER_GETHASH, SERIALIZE_TRANSACTION_NO_WITNESS);
68
68
}
69
69
70
- uint256 CTransaction::GetWitnessHash () const
70
+ uint256 CTransaction::ComputeWitnessHash () const
71
71
{
72
72
if (!HasWitness ()) {
73
- return GetHash () ;
73
+ return hash ;
74
74
}
75
75
return SerializeHash (*this , SER_GETHASH, 0 );
76
76
}
77
77
78
78
/* For backward compatibility, the hash is initialized to 0. TODO: remove the need for this default constructor entirely. */
79
- CTransaction::CTransaction () : vin(), vout(), nVersion(CTransaction::CURRENT_VERSION), nLockTime(0 ), hash() {}
80
- CTransaction::CTransaction (const CMutableTransaction & tx) : vin(tx.vin), vout(tx.vout), nVersion(tx.nVersion), nLockTime(tx.nLockTime), hash( ComputeHash()) {}
81
- CTransaction::CTransaction (CMutableTransaction && tx) : vin(std::move(tx.vin)), vout(std::move(tx.vout)), nVersion(tx.nVersion), nLockTime(tx.nLockTime), hash( ComputeHash()) {}
79
+ CTransaction::CTransaction () : vin(), vout(), nVersion(CTransaction::CURRENT_VERSION), nLockTime(0 ), hash{}, m_witness_hash{} {}
80
+ CTransaction::CTransaction (const CMutableTransaction& tx) : vin(tx.vin), vout(tx.vout), nVersion(tx.nVersion), nLockTime(tx.nLockTime), hash{ ComputeHash ()}, m_witness_hash{ ComputeWitnessHash ()} {}
81
+ CTransaction::CTransaction (CMutableTransaction&& tx) : vin(std::move(tx.vin)), vout(std::move(tx.vout)), nVersion(tx.nVersion), nLockTime(tx.nLockTime), hash{ ComputeHash ()}, m_witness_hash{ ComputeWitnessHash ()} {}
82
82
83
83
CAmount CTransaction::GetValueOut () const
84
84
{
0 commit comments