]> Git Repo - VerusCoin.git/blob - src/addressindex.h
Merge branch 'dev' into assetchain-conf
[VerusCoin.git] / src / addressindex.h
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.
5
6 #ifndef BITCOIN_ADDRESSINDEX_H
7 #define BITCOIN_ADDRESSINDEX_H
8
9 #include "uint256.h"
10 #include "amount.h"
11
12 struct CMempoolAddressDelta
13 {
14     int64_t time;
15     CAmount amount;
16     uint256 prevhash;
17     unsigned int prevout;
18
19     CMempoolAddressDelta(int64_t t, CAmount a, uint256 hash, unsigned int out) {
20         time = t;
21         amount = a;
22         prevhash = hash;
23         prevout = out;
24     }
25
26     CMempoolAddressDelta(int64_t t, CAmount a) {
27         time = t;
28         amount = a;
29         prevhash.SetNull();
30         prevout = 0;
31     }
32 };
33
34 struct CMempoolAddressDeltaKey
35 {
36     int type;
37     uint160 addressBytes;
38     uint256 txhash;
39     unsigned int index;
40     int spending;
41
42     CMempoolAddressDeltaKey(int addressType, uint160 addressHash, uint256 hash, unsigned int i, int s) {
43         type = addressType;
44         addressBytes = addressHash;
45         txhash = hash;
46         index = i;
47         spending = s;
48     }
49
50     CMempoolAddressDeltaKey(int addressType, uint160 addressHash) {
51         type = addressType;
52         addressBytes = addressHash;
53         txhash.SetNull();
54         index = 0;
55         spending = 0;
56     }
57 };
58
59 struct CMempoolAddressDeltaKeyCompare
60 {
61     bool operator()(const CMempoolAddressDeltaKey& a, const CMempoolAddressDeltaKey& b) const {
62         if (a.type == b.type) {
63             if (a.addressBytes == b.addressBytes) {
64                 if (a.txhash == b.txhash) {
65                     if (a.index == b.index) {
66                         return a.spending < b.spending;
67                     } else {
68                         return a.index < b.index;
69                     }
70                 } else {
71                     return a.txhash < b.txhash;
72                 }
73             } else {
74                 return a.addressBytes < b.addressBytes;
75             }
76         } else {
77             return a.type < b.type;
78         }
79     }
80 };
81
82 #endif // BITCOIN_ADDRESSINDEX_H
This page took 0.025918 seconds and 4 git commands to generate.