]> Git Repo - VerusCoin.git/blame - src/spentindex.h
Fix stakeguard validation
[VerusCoin.git] / src / spentindex.h
CommitLineData
3d018ab5
LR
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
bc909a7a 4// file COPYING or https://www.opensource.org/licenses/mit-license.php .
3d018ab5
LR
5
6#ifndef BITCOIN_SPENTINDEX_H
7#define BITCOIN_SPENTINDEX_H
8
9#include "uint256.h"
10#include "amount.h"
11
12struct CSpentIndexKey {
13 uint256 txid;
14 unsigned int outputIndex;
15
16 ADD_SERIALIZE_METHODS;
17
18 template <typename Stream, typename Operation>
19 inline void SerializationOp(Stream& s, Operation ser_action) {
20 READWRITE(txid);
21 READWRITE(outputIndex);
22 }
23
24 CSpentIndexKey(uint256 t, unsigned int i) {
25 txid = t;
26 outputIndex = i;
27 }
28
29 CSpentIndexKey() {
30 SetNull();
31 }
32
33 void SetNull() {
34 txid.SetNull();
35 outputIndex = 0;
36 }
37};
38
39struct CSpentIndexValue {
40 uint256 txid;
41 unsigned int inputIndex;
42 int blockHeight;
43 CAmount satoshis;
44 int addressType;
45 uint160 addressHash;
46
47 ADD_SERIALIZE_METHODS;
48
49 template <typename Stream, typename Operation>
50 inline void SerializationOp(Stream& s, Operation ser_action) {
51 READWRITE(txid);
52 READWRITE(inputIndex);
53 READWRITE(blockHeight);
54 READWRITE(satoshis);
55 READWRITE(addressType);
56 READWRITE(addressHash);
57 }
58
59 CSpentIndexValue(uint256 t, unsigned int i, int h, CAmount s, int type, uint160 a) {
60 txid = t;
61 inputIndex = i;
62 blockHeight = h;
63 satoshis = s;
64 addressType = type;
65 addressHash = a;
66 }
67
68 CSpentIndexValue() {
69 SetNull();
70 }
71
72 void SetNull() {
73 txid.SetNull();
74 inputIndex = 0;
75 blockHeight = 0;
76 satoshis = 0;
77 addressType = 0;
78 addressHash.SetNull();
79 }
80
81 bool IsNull() const {
82 return txid.IsNull();
83 }
84};
85
86struct CSpentIndexKeyCompare
87{
88 bool operator()(const CSpentIndexKey& a, const CSpentIndexKey& b) const {
89 if (a.txid == b.txid) {
90 return a.outputIndex < b.outputIndex;
91 } else {
92 return a.txid < b.txid;
93 }
94 }
95};
96
97#endif // BITCOIN_SPENTINDEX_H
This page took 0.061169 seconds and 4 git commands to generate.