|
|
@ -30,7 +30,14 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
COutPoint() { SetNull(); } |
|
|
|
COutPoint() { SetNull(); } |
|
|
|
COutPoint(uint256 hashIn, uint32_t nIn) { hash = hashIn; n = nIn; } |
|
|
|
COutPoint(uint256 hashIn, uint32_t nIn) { hash = hashIn; n = nIn; } |
|
|
|
IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); ) |
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SERIALIZE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
|
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
|
|
|
|
READWRITE(FLATDATA(*this)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SetNull() { hash = 0; n = (uint32_t) -1; } |
|
|
|
void SetNull() { hash = 0; n = (uint32_t) -1; } |
|
|
|
bool IsNull() const { return (hash == 0 && n == (uint32_t) -1); } |
|
|
|
bool IsNull() const { return (hash == 0 && n == (uint32_t) -1); } |
|
|
|
|
|
|
|
|
|
|
@ -84,12 +91,14 @@ public: |
|
|
|
explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=std::numeric_limits<unsigned int>::max()); |
|
|
|
explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=std::numeric_limits<unsigned int>::max()); |
|
|
|
CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=std::numeric_limits<uint32_t>::max()); |
|
|
|
CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=std::numeric_limits<uint32_t>::max()); |
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SERIALIZE |
|
|
|
IMPLEMENT_SERIALIZE; |
|
|
|
( |
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
|
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
READWRITE(prevout); |
|
|
|
READWRITE(prevout); |
|
|
|
READWRITE(scriptSig); |
|
|
|
READWRITE(scriptSig); |
|
|
|
READWRITE(nSequence); |
|
|
|
READWRITE(nSequence); |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool IsFinal() const |
|
|
|
bool IsFinal() const |
|
|
|
{ |
|
|
|
{ |
|
|
@ -136,7 +145,12 @@ public: |
|
|
|
friend bool operator>=(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK >= b.nSatoshisPerK; } |
|
|
|
friend bool operator>=(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK >= b.nSatoshisPerK; } |
|
|
|
std::string ToString() const; |
|
|
|
std::string ToString() const; |
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SERIALIZE( READWRITE(nSatoshisPerK); ) |
|
|
|
IMPLEMENT_SERIALIZE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
|
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
|
|
|
|
READWRITE(nSatoshisPerK); |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -156,11 +170,13 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
CTxOut(int64_t nValueIn, CScript scriptPubKeyIn); |
|
|
|
CTxOut(int64_t nValueIn, CScript scriptPubKeyIn); |
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SERIALIZE |
|
|
|
IMPLEMENT_SERIALIZE; |
|
|
|
( |
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
|
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
READWRITE(nValue); |
|
|
|
READWRITE(nValue); |
|
|
|
READWRITE(scriptPubKey); |
|
|
|
READWRITE(scriptPubKey); |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SetNull() |
|
|
|
void SetNull() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -237,7 +253,12 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
CTransaction& operator=(const CTransaction& tx); |
|
|
|
CTransaction& operator=(const CTransaction& tx); |
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SERIALIZE( |
|
|
|
IMPLEMENT_SERIALIZE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
|
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
|
|
|
|
bool fRead = ser_action.ForRead(); |
|
|
|
|
|
|
|
|
|
|
|
READWRITE(*const_cast<int32_t*>(&this->nVersion)); |
|
|
|
READWRITE(*const_cast<int32_t*>(&this->nVersion)); |
|
|
|
nVersion = this->nVersion; |
|
|
|
nVersion = this->nVersion; |
|
|
|
READWRITE(*const_cast<std::vector<CTxIn>*>(&vin)); |
|
|
|
READWRITE(*const_cast<std::vector<CTxIn>*>(&vin)); |
|
|
@ -245,7 +266,7 @@ public: |
|
|
|
READWRITE(*const_cast<uint32_t*>(&nLockTime)); |
|
|
|
READWRITE(*const_cast<uint32_t*>(&nLockTime)); |
|
|
|
if (fRead) |
|
|
|
if (fRead) |
|
|
|
UpdateHash(); |
|
|
|
UpdateHash(); |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool IsNull() const { |
|
|
|
bool IsNull() const { |
|
|
|
return vin.empty() && vout.empty(); |
|
|
|
return vin.empty() && vout.empty(); |
|
|
@ -292,13 +313,16 @@ struct CMutableTransaction |
|
|
|
CMutableTransaction(); |
|
|
|
CMutableTransaction(); |
|
|
|
CMutableTransaction(const CTransaction& tx); |
|
|
|
CMutableTransaction(const CTransaction& tx); |
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SERIALIZE( |
|
|
|
IMPLEMENT_SERIALIZE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
|
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
READWRITE(this->nVersion); |
|
|
|
READWRITE(this->nVersion); |
|
|
|
nVersion = this->nVersion; |
|
|
|
nVersion = this->nVersion; |
|
|
|
READWRITE(vin); |
|
|
|
READWRITE(vin); |
|
|
|
READWRITE(vout); |
|
|
|
READWRITE(vout); |
|
|
|
READWRITE(nLockTime); |
|
|
|
READWRITE(nLockTime); |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** Compute the hash of this CMutableTransaction. This is computed on the
|
|
|
|
/** Compute the hash of this CMutableTransaction. This is computed on the
|
|
|
|
* fly, as opposed to GetHash() in CTransaction, which uses a cached result. |
|
|
|
* fly, as opposed to GetHash() in CTransaction, which uses a cached result. |
|
|
@ -318,7 +342,11 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
CTxOutCompressor(CTxOut &txoutIn) : txout(txoutIn) { } |
|
|
|
CTxOutCompressor(CTxOut &txoutIn) : txout(txoutIn) { } |
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SERIALIZE(({ |
|
|
|
IMPLEMENT_SERIALIZE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
|
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
|
|
|
|
bool fRead = ser_action.ForRead(); |
|
|
|
if (!fRead) { |
|
|
|
if (!fRead) { |
|
|
|
uint64_t nVal = CompressAmount(txout.nValue); |
|
|
|
uint64_t nVal = CompressAmount(txout.nValue); |
|
|
|
READWRITE(VARINT(nVal)); |
|
|
|
READWRITE(VARINT(nVal)); |
|
|
@ -329,7 +357,7 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
CScriptCompressor cscript(REF(txout.scriptPubKey)); |
|
|
|
CScriptCompressor cscript(REF(txout.scriptPubKey)); |
|
|
|
READWRITE(cscript); |
|
|
|
READWRITE(cscript); |
|
|
|
});) |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** Undo information for a CTxIn
|
|
|
|
/** Undo information for a CTxIn
|
|
|
@ -382,9 +410,12 @@ public: |
|
|
|
// undo information for all txins
|
|
|
|
// undo information for all txins
|
|
|
|
std::vector<CTxInUndo> vprevout; |
|
|
|
std::vector<CTxInUndo> vprevout; |
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SERIALIZE( |
|
|
|
IMPLEMENT_SERIALIZE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
|
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
READWRITE(vprevout); |
|
|
|
READWRITE(vprevout); |
|
|
|
) |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -412,8 +443,10 @@ public: |
|
|
|
SetNull(); |
|
|
|
SetNull(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SERIALIZE |
|
|
|
IMPLEMENT_SERIALIZE; |
|
|
|
( |
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
|
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
READWRITE(this->nVersion); |
|
|
|
READWRITE(this->nVersion); |
|
|
|
nVersion = this->nVersion; |
|
|
|
nVersion = this->nVersion; |
|
|
|
READWRITE(hashPrevBlock); |
|
|
|
READWRITE(hashPrevBlock); |
|
|
@ -421,7 +454,7 @@ public: |
|
|
|
READWRITE(nTime); |
|
|
|
READWRITE(nTime); |
|
|
|
READWRITE(nBits); |
|
|
|
READWRITE(nBits); |
|
|
|
READWRITE(nNonce); |
|
|
|
READWRITE(nNonce); |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SetNull() |
|
|
|
void SetNull() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -467,11 +500,13 @@ public: |
|
|
|
*((CBlockHeader*)this) = header; |
|
|
|
*((CBlockHeader*)this) = header; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SERIALIZE |
|
|
|
IMPLEMENT_SERIALIZE; |
|
|
|
( |
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
|
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
READWRITE(*(CBlockHeader*)this); |
|
|
|
READWRITE(*(CBlockHeader*)this); |
|
|
|
READWRITE(vtx); |
|
|
|
READWRITE(vtx); |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SetNull() |
|
|
|
void SetNull() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -515,12 +550,14 @@ struct CBlockLocator |
|
|
|
vHave = vHaveIn; |
|
|
|
vHave = vHaveIn; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SERIALIZE |
|
|
|
IMPLEMENT_SERIALIZE; |
|
|
|
( |
|
|
|
|
|
|
|
|
|
|
|
template <typename Stream, typename Operation> |
|
|
|
|
|
|
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { |
|
|
|
if (!(nType & SER_GETHASH)) |
|
|
|
if (!(nType & SER_GETHASH)) |
|
|
|
READWRITE(nVersion); |
|
|
|
READWRITE(nVersion); |
|
|
|
READWRITE(vHave); |
|
|
|
READWRITE(vHave); |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SetNull() |
|
|
|
void SetNull() |
|
|
|
{ |
|
|
|
{ |
|
|
|