Changeset View
Changeset View
Standalone View
Standalone View
src/primitives/transaction.h
Show All 32 Lines | |||||
* vout. | * vout. | ||||
*/ | */ | ||||
class COutPoint { | class COutPoint { | ||||
private: | private: | ||||
uint256 txid; | uint256 txid; | ||||
uint32_t n; | uint32_t n; | ||||
public: | public: | ||||
COutPoint() { SetNull(); } | COutPoint() : txid(), n(-1) {} | ||||
COutPoint(uint256 txidIn, uint32_t nIn) { | COutPoint(uint256 txidIn, uint32_t nIn) { | ||||
txid = txidIn; | txid = txidIn; | ||||
n = nIn; | n = nIn; | ||||
} | } | ||||
ADD_SERIALIZE_METHODS; | ADD_SERIALIZE_METHODS; | ||||
template <typename Stream, typename Operation> | template <typename Stream, typename Operation> | ||||
inline void SerializationOp(Stream &s, Operation ser_action) { | inline void SerializationOp(Stream &s, Operation ser_action) { | ||||
READWRITE(txid); | READWRITE(txid); | ||||
READWRITE(n); | READWRITE(n); | ||||
} | } | ||||
void SetNull() { | |||||
txid.SetNull(); | |||||
n = uint32_t(-1); | |||||
} | |||||
bool IsNull() const { return txid.IsNull() && n == uint32_t(-1); } | bool IsNull() const { return txid.IsNull() && n == uint32_t(-1); } | ||||
TxId GetTxId() const { return TxId(txid); } | TxId GetTxId() const { return TxId(txid); } | ||||
uint32_t GetN() const { return n; } | uint32_t GetN() const { return n; } | ||||
friend bool operator<(const COutPoint &a, const COutPoint &b) { | friend bool operator<(const COutPoint &a, const COutPoint &b) { | ||||
int cmp = a.txid.Compare(b.txid); | int cmp = a.txid.Compare(b.txid); | ||||
return cmp < 0 || (cmp == 0 && a.n < b.n); | return cmp < 0 || (cmp == 0 && a.n < b.n); | ||||
▲ Show 20 Lines • Show All 339 Lines • Show Last 20 Lines |