kernel.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // ECOin - Copyright (c) - 2014/2022 - GPLv3 - epsylon@riseup.net (https://03c8.net)
  2. #ifndef ECOIN_KERNEL_H
  3. #define ECOIN_KERNEL_H
  4. #include "main.h"
  5. // MODIFIER_INTERVAL: time to elapse before new modifier is computed
  6. extern unsigned int nModifierInterval;
  7. // MODIFIER_INTERVAL_RATIO:
  8. // ratio of group interval length between the last group and the first group
  9. static const int MODIFIER_INTERVAL_RATIO = 3;
  10. // Compute the hash modifier for proof-of-stake
  11. bool ComputeNextStakeModifier(const CBlockIndex* pindexPrev, uint64& nStakeModifier, bool& fGeneratedStakeModifier);
  12. // Check whether stake kernel meets hash target
  13. // Sets hashProofOfStake on success return
  14. 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);
  15. // Check kernel hash target and coinstake signature
  16. // Sets hashProofOfStake on success return
  17. bool CheckProofOfStake(const CTransaction& tx, unsigned int nBits, uint256& hashProofOfStake, uint256& targetProofOfStake);
  18. // Check whether the coinstake timestamp meets protocol
  19. bool CheckCoinStakeTimestamp(int64 nTimeBlock, int64 nTimeTx);
  20. // Get stake modifier checksum
  21. unsigned int GetStakeModifierChecksum(const CBlockIndex* pindex);
  22. // Check stake modifier hard checkpoints
  23. bool CheckStakeModifierCheckpoints(int nHeight, unsigned int nStakeModifierChecksum);
  24. // Get time weight using supplied timestamps
  25. int64 GetWeight(int64 nIntervalBeginning, int64 nIntervalEnd);
  26. #endif // ECOIN_KERNEL_H