1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2015 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or https://www.opensource.org/licenses/mit-license.php .
6 #ifndef BITCOIN_SPENTINDEX_H
7 #define BITCOIN_SPENTINDEX_H
12 struct CSpentIndexKey {
14 unsigned int outputIndex;
16 ADD_SERIALIZE_METHODS;
18 template <typename Stream, typename Operation>
19 inline void SerializationOp(Stream& s, Operation ser_action) {
21 READWRITE(outputIndex);
24 CSpentIndexKey(uint256 t, unsigned int i) {
39 struct CSpentIndexValue {
41 unsigned int inputIndex;
47 ADD_SERIALIZE_METHODS;
49 template <typename Stream, typename Operation>
50 inline void SerializationOp(Stream& s, Operation ser_action) {
52 READWRITE(inputIndex);
53 READWRITE(blockHeight);
55 READWRITE(addressType);
56 READWRITE(addressHash);
59 CSpentIndexValue(uint256 t, unsigned int i, int h, CAmount s, int type, uint160 a) {
78 addressHash.SetNull();
86 struct CSpentIndexKeyCompare
88 bool operator()(const CSpentIndexKey& a, const CSpentIndexKey& b) const {
89 if (a.txid == b.txid) {
90 return a.outputIndex < b.outputIndex;
92 return a.txid < b.txid;
97 #endif // BITCOIN_SPENTINDEX_H