|
|
@ -67,18 +67,18 @@ uint256 CTransaction::ComputeHash() const
|
|
|
|
return SerializeHash(*this, SER_GETHASH, SERIALIZE_TRANSACTION_NO_WITNESS);
|
|
|
|
return SerializeHash(*this, SER_GETHASH, SERIALIZE_TRANSACTION_NO_WITNESS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint256 CTransaction::GetWitnessHash() const
|
|
|
|
uint256 CTransaction::ComputeWitnessHash() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!HasWitness()) {
|
|
|
|
if (!HasWitness()) {
|
|
|
|
return GetHash();
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return SerializeHash(*this, SER_GETHASH, 0);
|
|
|
|
return SerializeHash(*this, SER_GETHASH, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* For backward compatibility, the hash is initialized to 0. TODO: remove the need for this default constructor entirely. */
|
|
|
|
/* For backward compatibility, the hash is initialized to 0. TODO: remove the need for this default constructor entirely. */
|
|
|
|
CTransaction::CTransaction() : vin(), vout(), nVersion(CTransaction::CURRENT_VERSION), nLockTime(0), hash() {}
|
|
|
|
CTransaction::CTransaction() : vin(), vout(), nVersion(CTransaction::CURRENT_VERSION), nLockTime(0), hash{}, m_witness_hash{} {}
|
|
|
|
CTransaction::CTransaction(const CMutableTransaction &tx) : vin(tx.vin), vout(tx.vout), nVersion(tx.nVersion), nLockTime(tx.nLockTime), hash(ComputeHash()) {}
|
|
|
|
CTransaction::CTransaction(const CMutableTransaction& tx) : vin(tx.vin), vout(tx.vout), nVersion(tx.nVersion), nLockTime(tx.nLockTime), hash{ComputeHash()}, m_witness_hash{ComputeWitnessHash()} {}
|
|
|
|
CTransaction::CTransaction(CMutableTransaction &&tx) : vin(std::move(tx.vin)), vout(std::move(tx.vout)), nVersion(tx.nVersion), nLockTime(tx.nLockTime), hash(ComputeHash()) {}
|
|
|
|
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()} {}
|
|
|
|
|
|
|
|
|
|
|
|
CAmount CTransaction::GetValueOut() const
|
|
|
|
CAmount CTransaction::GetValueOut() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|