Changeset View
Changeset View
Standalone View
Standalone View
src/primitives/transaction.h
Show First 20 Lines • Show All 286 Lines • ▼ Show 20 Lines | public: | ||||
} | } | ||||
friend bool operator!=(const CTransaction &a, const CTransaction &b) { | friend bool operator!=(const CTransaction &a, const CTransaction &b) { | ||||
return a.hash != b.hash; | return a.hash != b.hash; | ||||
} | } | ||||
std::string ToString() const; | std::string ToString() const; | ||||
}; | }; | ||||
static_assert(sizeof(CTransaction) == 88); | #if defined(__x86_64__) | ||||
static_assert(sizeof(CTransaction) == 88, | |||||
"sizeof CTransaction is expected to be 88 bytes"); | |||||
#endif | |||||
/** | /** | ||||
* A mutable version of CTransaction. | * A mutable version of CTransaction. | ||||
*/ | */ | ||||
class CMutableTransaction { | class CMutableTransaction { | ||||
public: | public: | ||||
std::vector<CTxIn> vin; | std::vector<CTxIn> vin; | ||||
std::vector<CTxOut> vout; | std::vector<CTxOut> vout; | ||||
Show All 24 Lines | public: | ||||
TxId GetId() const; | TxId GetId() const; | ||||
TxHash GetHash() const; | TxHash GetHash() const; | ||||
friend bool operator==(const CMutableTransaction &a, | friend bool operator==(const CMutableTransaction &a, | ||||
const CMutableTransaction &b) { | const CMutableTransaction &b) { | ||||
return a.GetId() == b.GetId(); | return a.GetId() == b.GetId(); | ||||
} | } | ||||
}; | }; | ||||
static_assert(sizeof(CMutableTransaction) == 56); | #if defined(__x86_64__) | ||||
static_assert(sizeof(CMutableTransaction) == 56, | |||||
"sizeof CMutableTransaction is expected to be 56 bytes"); | |||||
#endif | |||||
typedef std::shared_ptr<const CTransaction> CTransactionRef; | typedef std::shared_ptr<const CTransaction> CTransactionRef; | ||||
static inline CTransactionRef MakeTransactionRef() { | static inline CTransactionRef MakeTransactionRef() { | ||||
return std::make_shared<const CTransaction>(); | return std::make_shared<const CTransaction>(); | ||||
} | } | ||||
template <typename Tx> | template <typename Tx> | ||||
static inline CTransactionRef MakeTransactionRef(Tx &&txIn) { | static inline CTransactionRef MakeTransactionRef(Tx &&txIn) { | ||||
return std::make_shared<const CTransaction>(std::forward<Tx>(txIn)); | return std::make_shared<const CTransaction>(std::forward<Tx>(txIn)); | ||||
Show All 17 Lines |