@@ -55,15 +55,15 @@ std::string CTxOut::ToString() const
55
55
return strprintf (" CTxOut(nValue=%d.%08d, scriptPubKey=%s)" , nValue / UNIT, nValue % UNIT, HexStr (scriptPubKey).substr (0 , 30 ));
56
56
}
57
57
58
- CMutableTransaction::CMutableTransaction () : nVersion (CTransaction::CURRENT_VERSION), nLockTime(0 ) {}
59
- CMutableTransaction::CMutableTransaction (const CTransaction& tx) : vin(tx.vin), vout(tx.vout), nVersion (tx.nVersion ), nLockTime(tx.nLockTime) {}
58
+ CMutableTransaction::CMutableTransaction () : version (CTransaction::CURRENT_VERSION), type(TxType::REGULAR ), nLockTime(0 ) {}
59
+ CMutableTransaction::CMutableTransaction (const CTransaction& tx) : vin(tx.vin), vout(tx.vout), version (tx.version), type(tx.type ), nLockTime(tx.nLockTime) {}
60
60
61
61
void CMutableTransaction::SetType (TxType type) {
62
- nVersion = (nVersion & 0x0000FFFF ) | ( static_cast <uint16_t >(type) << 16 );
62
+ this -> type = static_cast <uint8_t >(type);
63
63
}
64
64
65
- void CMutableTransaction::SetVersion (uint16_t type ) {
66
- nVersion = (nVersion & 0xFFFF0000 ) | ( static_cast < uint16_t >(type)) ;
65
+ void CMutableTransaction::SetVersion (uint8_t version ) {
66
+ this -> version = version ;
67
67
}
68
68
69
69
uint256 CMutableTransaction::GetHash () const
@@ -85,9 +85,9 @@ uint256 CTransaction::ComputeWitnessHash() const
85
85
}
86
86
87
87
/* For backward compatibility, the hash is initialized to 0. TODO: remove the need for this default constructor entirely. */
88
- CTransaction::CTransaction () : vin(), vout(), nVersion (CTransaction::CURRENT_VERSION), nLockTime(0 ), hash{}, m_witness_hash{} {}
89
- CTransaction::CTransaction (const CMutableTransaction& tx) : vin(tx.vin), vout(tx.vout), nVersion (tx.nVersion ), nLockTime(tx.nLockTime), hash{ComputeHash ()}, m_witness_hash{ComputeWitnessHash ()} {}
90
- 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 ()} {}
88
+ CTransaction::CTransaction () : vin(), vout(), version (CTransaction::CURRENT_VERSION), type(TxType::REGULAR ), nLockTime(0 ), hash{}, m_witness_hash{} {}
89
+ CTransaction::CTransaction (const CMutableTransaction& tx) : vin(tx.vin), vout(tx.vout), version (tx.version), type(tx.type ), nLockTime(tx.nLockTime), hash{ComputeHash ()}, m_witness_hash{ComputeWitnessHash ()} {}
90
+ CTransaction::CTransaction (CMutableTransaction&& tx) : vin(std::move(tx.vin)), vout(std::move(tx.vout)), version (tx.version), type(tx.type ), nLockTime(tx.nLockTime), hash{ComputeHash ()}, m_witness_hash{ComputeWitnessHash ()} {}
91
91
92
92
CAmount CTransaction::GetValueOut () const
93
93
{
@@ -110,7 +110,7 @@ std::string CTransaction::ToString() const
110
110
std::string str;
111
111
str += strprintf (" CTransaction(hash=%s, ver=%d, vin.size=%u, vout.size=%u, nLockTime=%u)\n " ,
112
112
GetHash ().ToString ().substr (0 ,10 ),
113
- nVersion ,
113
+ version ,
114
114
vin.size (),
115
115
vout.size (),
116
116
nLockTime);
0 commit comments