Bump version to 0.5.9
[novacoin.git] / src / kernelrecord.h
1 #ifndef KERNELRECORD_H
2 #define KERNELRECORD_H
3
4 #include "uint256.h"
5
6 class CWallet;
7 class CWalletTx;
8
9 class KernelRecord
10 {
11 public:
12     KernelRecord():
13         hash(), nTime(0), address(""), nValue(0), idx(0), spent(false), coinAge(0), prevMinutes(0), prevDifficulty(0), prevProbability(0)
14     {
15     }
16
17     KernelRecord(uint256 hash, int64_t nTime):
18             hash(hash), nTime(nTime), address(""), nValue(0), idx(0), spent(false), coinAge(0), prevMinutes(0), prevDifficulty(0), prevProbability(0)
19     {
20     }
21
22     KernelRecord(uint256 hash, int64_t nTime,
23                  const std::string &address,
24                  int64_t nValue, bool spent, int64_t coinAge):
25         hash(hash), nTime(nTime), address(address), nValue(nValue),
26         idx(0), spent(spent), coinAge(coinAge), prevMinutes(0), prevDifficulty(0), prevProbability(0)
27     {
28     }
29
30     static bool showTransaction(const CWalletTx &wtx);
31     static std::vector<KernelRecord> decomposeOutput(const CWallet *wallet, const CWalletTx &wtx);
32
33
34     uint256 hash;
35     int64_t nTime;
36     std::string address;
37     int64_t nValue;
38     int idx;
39     bool spent;
40     int64_t coinAge;
41
42     std::string getTxID();
43     int64_t getAge() const;
44     uint64_t getCoinDay() const;
45     double getProbToMintStake(double difficulty, int timeOffset = 0) const;
46     double getProbToMintWithinNMinutes(double difficulty, int minutes);
47     int64_t getPoSReward(int nBits, int timeOffset);
48 protected:
49     int prevMinutes;
50     double prevDifficulty;
51     double prevProbability;
52 };
53
54 #endif // KERNELRECORD_H