Transactions verification update
[novacoin.git] / src / kernel.h
1 // Copyright (c) 2012-2013 The PPCoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 #ifndef PPCOIN_KERNEL_H
5 #define PPCOIN_KERNEL_H
6
7 #include "main.h"
8
9 // MODIFIER_INTERVAL: time to elapse before new modifier is computed
10 extern unsigned int nModifierInterval;
11
12 // MODIFIER_INTERVAL_RATIO:
13 // ratio of group interval length between the last group and the first group
14 static const int MODIFIER_INTERVAL_RATIO = 3;
15
16 // Compute the hash modifier for proof-of-stake
17 bool ComputeNextStakeModifier(const CBlockIndex* pindexPrev, uint64& nStakeModifier, bool& fGeneratedStakeModifier);
18
19 // Check whether stake kernel meets hash target
20 // Sets hashProofOfStake on success return
21 bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned int nTxPrevOffset, const CTransaction& txPrev, const COutPoint& prevout, unsigned int nTimeTx, uint256& hashProofOfStake, uint256& targetProofOfStake, bool fPrintProofOfStake=false);
22
23 // Check kernel hash target and coinstake signature
24 // Sets hashProofOfStake on success return
25 bool CheckProofOfStake(const CTransaction& tx, unsigned int nBits, uint256& hashProofOfStake, uint256& targetProofOfStake);
26
27 // Get stake modifier checksum
28 unsigned int GetStakeModifierChecksum(const CBlockIndex* pindex);
29
30 // Check stake modifier hard checkpoints
31 bool CheckStakeModifierCheckpoints(int nHeight, unsigned int nStakeModifierChecksum);
32
33 // Get time weight using supplied timestamps
34 int64 GetWeight(int64 nIntervalBeginning, int64 nIntervalEnd);
35
36 #endif // PPCOIN_KERNEL_H