Changeset View
Changeset View
Standalone View
Standalone View
src/primitives/transaction.h
Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | public: | ||||
*/ | */ | ||||
unsigned int GetTotalSize() const; | unsigned int GetTotalSize() const; | ||||
bool IsCoinBase() const { | bool IsCoinBase() const { | ||||
return (vin.size() == 1 && vin[0].prevout.IsNull()); | return (vin.size() == 1 && vin[0].prevout.IsNull()); | ||||
} | } | ||||
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.GetHash() == b.GetHash(); | ||||
} | } | ||||
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 == b); | ||||
} | } | ||||
std::string ToString() const; | std::string ToString() const; | ||||
}; | }; | ||||
#if defined(__x86_64__) | #if defined(__x86_64__) | ||||
static_assert(sizeof(CTransaction) == 88, | static_assert(sizeof(CTransaction) == 88, | ||||
"sizeof CTransaction is expected to be 88 bytes"); | "sizeof CTransaction is expected to be 88 bytes"); | ||||
#endif | #endif | ||||
Show All 29 Lines | public: | ||||
* the fly, as opposed to GetId() and GetHash() in CTransaction, which uses | * the fly, as opposed to GetId() and GetHash() in CTransaction, which uses | ||||
* a cached result. | * a cached result. | ||||
*/ | */ | ||||
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.GetHash() == b.GetHash(); | ||||
} | } | ||||
}; | }; | ||||
#if defined(__x86_64__) | #if defined(__x86_64__) | ||||
static_assert(sizeof(CMutableTransaction) == 56, | static_assert(sizeof(CMutableTransaction) == 56, | ||||
"sizeof CMutableTransaction is expected to be 56 bytes"); | "sizeof CMutableTransaction is expected to be 56 bytes"); | ||||
#endif | #endif | ||||
typedef std::shared_ptr<const CTransaction> CTransactionRef; | typedef std::shared_ptr<const CTransaction> CTransactionRef; | ||||
Show All 23 Lines |