| 33 | namespace { |
| 34 | |
| 35 | struct CoinEntry { |
| 36 | COutPoint* outpoint; |
| 37 | char key; |
| 38 | explicit CoinEntry(const COutPoint* ptr) : outpoint(const_cast<COutPoint*>(ptr)), key(DB_COIN) {} |
| 39 | |
| 40 | template<typename Stream> |
| 41 | void Serialize(Stream &s) const { |
| 42 | s << key; |
| 43 | s << outpoint->hash; |
| 44 | s << VARINT(outpoint->n); |
| 45 | } |
| 46 | |
| 47 | template<typename Stream> |
| 48 | void Unserialize(Stream& s) { |
| 49 | s >> key; |
| 50 | s >> outpoint->hash; |
| 51 | s >> VARINT(outpoint->n); |
| 52 | } |
| 53 | }; |
| 54 | |
| 55 | } |
| 56 |