Changeset View
Changeset View
Standalone View
Standalone View
src/primitives/transaction.h
Show All 24 Lines | private: | ||||
uint32_t n; | uint32_t n; | ||||
public: | public: | ||||
static constexpr uint32_t NULL_INDEX = std::numeric_limits<uint32_t>::max(); | static constexpr uint32_t NULL_INDEX = std::numeric_limits<uint32_t>::max(); | ||||
COutPoint() : txid(), n(NULL_INDEX) {} | COutPoint() : txid(), n(NULL_INDEX) {} | ||||
COutPoint(TxId txidIn, uint32_t nIn) : txid(txidIn), n(nIn) {} | COutPoint(TxId txidIn, uint32_t nIn) : txid(txidIn), n(nIn) {} | ||||
ADD_SERIALIZE_METHODS; | SERIALIZE_METHODS(COutPoint, obj) { READWRITE(obj.txid, obj.n); } | ||||
template <typename Stream, typename Operation> | |||||
inline void SerializationOp(Stream &s, Operation ser_action) { | |||||
READWRITE(txid); | |||||
READWRITE(n); | |||||
} | |||||
bool IsNull() const { return txid.IsNull() && n == NULL_INDEX; } | bool IsNull() const { return txid.IsNull() && n == NULL_INDEX; } | ||||
const TxId &GetTxId() const { return txid; } | const TxId &GetTxId() const { return 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); | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | public: | ||||
explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn = CScript(), | explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn = CScript(), | ||||
uint32_t nSequenceIn = SEQUENCE_FINAL) | uint32_t nSequenceIn = SEQUENCE_FINAL) | ||||
: prevout(prevoutIn), scriptSig(scriptSigIn), nSequence(nSequenceIn) {} | : prevout(prevoutIn), scriptSig(scriptSigIn), nSequence(nSequenceIn) {} | ||||
CTxIn(TxId prevTxId, uint32_t nOut, CScript scriptSigIn = CScript(), | CTxIn(TxId prevTxId, uint32_t nOut, CScript scriptSigIn = CScript(), | ||||
uint32_t nSequenceIn = SEQUENCE_FINAL) | uint32_t nSequenceIn = SEQUENCE_FINAL) | ||||
: CTxIn(COutPoint(prevTxId, nOut), scriptSigIn, nSequenceIn) {} | : CTxIn(COutPoint(prevTxId, nOut), scriptSigIn, nSequenceIn) {} | ||||
ADD_SERIALIZE_METHODS; | SERIALIZE_METHODS(CTxIn, obj) { | ||||
READWRITE(obj.prevout, obj.scriptSig, obj.nSequence); | |||||
template <typename Stream, typename Operation> | |||||
inline void SerializationOp(Stream &s, Operation ser_action) { | |||||
READWRITE(prevout); | |||||
READWRITE(scriptSig); | |||||
READWRITE(nSequence); | |||||
} | } | ||||
friend bool operator==(const CTxIn &a, const CTxIn &b) { | friend bool operator==(const CTxIn &a, const CTxIn &b) { | ||||
return (a.prevout == b.prevout && a.scriptSig == b.scriptSig && | return (a.prevout == b.prevout && a.scriptSig == b.scriptSig && | ||||
a.nSequence == b.nSequence); | a.nSequence == b.nSequence); | ||||
} | } | ||||
friend bool operator!=(const CTxIn &a, const CTxIn &b) { return !(a == b); } | friend bool operator!=(const CTxIn &a, const CTxIn &b) { return !(a == b); } | ||||
Show All 10 Lines | public: | ||||
Amount nValue; | Amount nValue; | ||||
CScript scriptPubKey; | CScript scriptPubKey; | ||||
CTxOut() { SetNull(); } | CTxOut() { SetNull(); } | ||||
CTxOut(Amount nValueIn, CScript scriptPubKeyIn) | CTxOut(Amount nValueIn, CScript scriptPubKeyIn) | ||||
: nValue(nValueIn), scriptPubKey(scriptPubKeyIn) {} | : nValue(nValueIn), scriptPubKey(scriptPubKeyIn) {} | ||||
ADD_SERIALIZE_METHODS; | SERIALIZE_METHODS(CTxOut, obj) { READWRITE(obj.nValue, obj.scriptPubKey); } | ||||
template <typename Stream, typename Operation> | |||||
inline void SerializationOp(Stream &s, Operation ser_action) { | |||||
READWRITE(nValue); | |||||
READWRITE(scriptPubKey); | |||||
} | |||||
void SetNull() { | void SetNull() { | ||||
nValue = -SATOSHI; | nValue = -SATOSHI; | ||||
scriptPubKey.clear(); | scriptPubKey.clear(); | ||||
} | } | ||||
bool IsNull() const { return nValue == -SATOSHI; } | bool IsNull() const { return nValue == -SATOSHI; } | ||||
▲ Show 20 Lines • Show All 193 Lines • Show Last 20 Lines |