Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

addressindex.h
Go to the documentation of this file.
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 
13 {
14  int64_t time;
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 
35 {
36  int type;
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 
60 {
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
void SetNull()
Definition: uint256.h:41
CMempoolAddressDeltaKey(int addressType, uint160 addressHash, uint256 hash, unsigned int i, int s)
Definition: addressindex.h:42
CMempoolAddressDelta(int64_t t, CAmount a)
Definition: addressindex.h:26
CMempoolAddressDelta(int64_t t, CAmount a, uint256 hash, unsigned int out)
Definition: addressindex.h:19
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
CMempoolAddressDeltaKey(int addressType, uint160 addressHash)
Definition: addressindex.h:50
256-bit opaque blob.
Definition: uint256.h:123
160-bit opaque blob.
Definition: uint256.h:112
unsigned int prevout
Definition: addressindex.h:17
bool operator()(const CMempoolAddressDeltaKey &a, const CMempoolAddressDeltaKey &b) const
Definition: addressindex.h:61
Released under the MIT license