You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

checkpoints.h 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (c) 2009-2014 The Bitcoin Core developers
  2. // Distributed under the MIT software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #ifndef BITCOIN_CHECKPOINTS_H
  5. #define BITCOIN_CHECKPOINTS_H
  6. #include "uint256.h"
  7. #include <map>
  8. class CBlockIndex;
  9. /**
  10. * Block-chain checkpoints are compiled-in sanity checks.
  11. * They are updated every release or three.
  12. */
  13. namespace Checkpoints
  14. {
  15. typedef std::map<int, uint256> MapCheckpoints;
  16. struct CCheckpointData {
  17. MapCheckpoints mapCheckpoints;
  18. int64_t nTimeLastCheckpoint;
  19. int64_t nTransactionsLastCheckpoint;
  20. double fTransactionsPerDay;
  21. };
  22. //! Returns true if block passes checkpoint checks
  23. bool CheckBlock(const CCheckpointData& data, int nHeight, const uint256& hash);
  24. //! Return conservative estimate of total number of blocks, 0 if unknown
  25. int GetTotalBlocksEstimate(const CCheckpointData& data);
  26. //! Returns last CBlockIndex* in mapBlockIndex that is a checkpoint
  27. CBlockIndex* GetLastCheckpoint(const CCheckpointData& data);
  28. double GuessVerificationProgress(const CCheckpointData& data, CBlockIndex* pindex, bool fSigchecks = true);
  29. } //namespace Checkpoints
  30. #endif // BITCOIN_CHECKPOINTS_H