Undo information for a CTxIn * * Contains the prevout's CTxOut being spent, and its metadata as well * (coinbase or not, height). The serialization contains a dummy value of * zero. This is compatible with older versions which expect to see * the transaction version there. */
| 19 | * the transaction version there. |
| 20 | */ |
| 21 | class TxInUndoSerializer |
| 22 | { |
| 23 | const Coin* txout; |
| 24 | |
| 25 | public: |
| 26 | template<typename Stream> |
| 27 | void Serialize(Stream &s) const { |
| 28 | ::Serialize(s, VARINT(txout->nHeight * 2 + (txout->fCoinBase ? 1u : 0u))); |
| 29 | if (txout->nHeight > 0) { |
| 30 | // Required to maintain compatibility with older undo format. |
| 31 | ::Serialize(s, (unsigned char)0); |
| 32 | } |
| 33 | ::Serialize(s, CTxOutCompressor(REF(txout->out))); |
| 34 | } |
| 35 | |
| 36 | explicit TxInUndoSerializer(const Coin* coin) : txout(coin) {} |
| 37 | }; |
| 38 | |
| 39 | class TxInUndoDeserializer |
| 40 | { |