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 http://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, int nType, int nVersion) {
21 READWRITE(outputIndex);
24 CSpentIndexKey(uint256 t, unsigned int i) {
40 struct CSpentIndexValue {
42 unsigned int inputIndex;
48 ADD_SERIALIZE_METHODS;
50 template <typename Stream, typename Operation>
51 inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
53 READWRITE(inputIndex);
54 READWRITE(blockHeight);
56 READWRITE(addressType);
57 READWRITE(addressHash);
60 CSpentIndexValue(uint256 t, unsigned int i, int h, CAmount s, int type, uint160 a) {
79 addressHash.SetNull();
87 struct CSpentIndexKeyCompare
89 bool operator()(const CSpentIndexKey& a, const CSpentIndexKey& b) const {
90 if (a.txid == b.txid) {
91 return a.outputIndex < b.outputIndex;
93 return a.txid < b.txid;
98 #endif // BITCOIN_SPENTINDEX_H