-
Notifications
You must be signed in to change notification settings - Fork 1
/
BlockChainAddresses.h
69 lines (56 loc) · 1.73 KB
/
BlockChainAddresses.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef BLOCK_CHAIN_ADDRESSES_H
#define BLOCK_CHAIN_ADDRESSES_H
#include <stdint.h>
class BlockChainAddresses
{
public:
class StatAddress
{
public:
StatAddress(void)
{
mAddress = 0;
mTotalReceived = 0;
mTotalSent = 0;
mLastTime = 0;
mTransactionCount = 0;
mInputCount = 0;
mOutputCount = 0;
}
bool operator==(const StatAddress &a) const
{
return mAddress == a.mAddress &&
mTotalSent == a.mTotalSent &&
mTotalReceived == a.mTotalReceived &&
mFirstTime == a.mFirstTime &&
mLastTime == a.mLastTime &&
mTransactionCount == a.mTransactionCount &&
mInputCount == a.mInputCount &&
mOutputCount == a.mOutputCount;
}
uint32_t getBalance(void) const
{
return mTotalReceived - mTotalSent;
}
uint32_t mAddress; // the address index.
uint32_t mTotalSent; // total number of bitcoins sent
uint32_t mTotalReceived;
uint32_t mFirstTime; // first time this address was used
uint32_t mLastTime; // Last time a spend transaction occurred.
uint8_t mTransactionCount; // total number of transactions
uint8_t mInputCount; // total number of inputs.
uint8_t mOutputCount; // total number of outputs
};
virtual void printRow(void) = 0; // Print out for debugging purposes the data in this current row
virtual bool seekRow(uint32_t index) = 0; // Seek the file to this row location.
virtual uint32_t getRowCount(void) const = 0; // return the number of rows found in the file.
virtual void release(void) = 0; // release the interface
virtual const StatAddress *getRow(uint32_t &scount) = 0;
virtual uint32_t seekNextRow(void) = 0;
protected:
virtual ~BlockChainAddresses(void)
{
}
};
BlockChainAddresses *createBlockChainAddresses(const char *fname);
#endif