Changeset View
Changeset View
Standalone View
Standalone View
src/undo.h
Show All 27 Lines | |||||
*/ | */ | ||||
class TxInUndoSerializer { | class TxInUndoSerializer { | ||||
const Coin *pcoin; | const Coin *pcoin; | ||||
public: | public: | ||||
explicit TxInUndoSerializer(const Coin *pcoinIn) : pcoin(pcoinIn) {} | explicit TxInUndoSerializer(const Coin *pcoinIn) : pcoin(pcoinIn) {} | ||||
template <typename Stream> void Serialize(Stream &s) const { | template <typename Stream> void Serialize(Stream &s) const { | ||||
::Serialize( | ::Serialize(s, VARINT(pcoin->GetHeight() * 2 + | ||||
s, VARINT(pcoin->GetHeight() * 2 + (pcoin->IsCoinBase() ? 1 : 0))); | (pcoin->IsCoinBase() ? 1u : 0u))); | ||||
if (pcoin->GetHeight() > 0) { | if (pcoin->GetHeight() > 0) { | ||||
// Required to maintain compatibility with older undo format. | // Required to maintain compatibility with older undo format. | ||||
::Serialize(s, uint8_t(0)); | ::Serialize(s, uint8_t(0)); | ||||
} | } | ||||
::Serialize(s, CTxOutCompressor(REF(pcoin->GetTxOut()))); | ::Serialize(s, CTxOutCompressor(REF(pcoin->GetTxOut()))); | ||||
} | } | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |