924117311a6435ccfa95d02e3a9f99a9dec716c7
[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 static const unsigned int MODIFIER_INTERVAL = 6 * 60 * 60;
11 extern unsigned int nModifierInterval;
12
13 // MODIFIER_INTERVAL_RATIO:
14 // ratio of group interval length between the last group and the first group
15 static const int MODIFIER_INTERVAL_RATIO = 3;
16
17 // Compute the hash modifier for proof-of-stake
18 bool ComputeNextStakeModifier(const CBlockIndex* pindexPrev, uint64& nStakeModifier, bool& fGeneratedStakeModifier);
19
20 // Check whether stake kernel meets hash target
21 // Sets hashProofOfStake on success return
22 bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned int nTxPrevOffset, const CTransaction& txPrev, const COutPoint& prevout, unsigned int nTimeTx, uint256& hashProofOfStake, bool fPrintProofOfStake=false);
23
24 // Check kernel hash target and coinstake signature
25 // Sets hashProofOfStake on success return
26 bool CheckProofOfStake(const CTransaction& tx, unsigned int nBits, uint256& hashProofOfStake);
27
28 // Check whether the coinstake timestamp meets protocol
29 bool CheckCoinStakeTimestamp(int64 nTimeBlock, int64 nTimeTx);
30
31 // Get stake modifier checksum
32 unsigned int GetStakeModifierChecksum(const CBlockIndex* pindex);
33
34 // Check stake modifier hard checkpoints
35 bool CheckStakeModifierCheckpoints(int nHeight, unsigned int nStakeModifierChecksum);
36
37 #endif // PPCOIN_KERNEL_H