diff options
Diffstat (limited to 'src/checkpoints.cpp')
-rw-r--r-- | src/checkpoints.cpp | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index e3d42c2957..2024486139 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -24,14 +24,9 @@ namespace Checkpoints { */ static const double SIGCHECK_VERIFICATION_FACTOR = 5.0; - bool fEnabled = true; - - bool CheckBlock(int nHeight, const uint256& hash) + bool CheckBlock(const CCheckpointData& data, int nHeight, const uint256& hash) { - if (!fEnabled) - return true; - - const MapCheckpoints& checkpoints = *Params().Checkpoints().mapCheckpoints; + const MapCheckpoints& checkpoints = data.mapCheckpoints; MapCheckpoints::const_iterator i = checkpoints.find(nHeight); if (i == checkpoints.end()) return true; @@ -39,7 +34,7 @@ namespace Checkpoints { } //! Guess how far we are in the verification process at the given block index - double GuessVerificationProgress(CBlockIndex *pindex, bool fSigchecks) { + double GuessVerificationProgress(const CCheckpointData& data, CBlockIndex *pindex, bool fSigchecks) { if (pindex==NULL) return 0.0; @@ -51,8 +46,6 @@ namespace Checkpoints { // Work is defined as: 1.0 per transaction before the last checkpoint, and // fSigcheckVerificationFactor per transaction after. - const CCheckpointData &data = Params().Checkpoints(); - if (pindex->nChainTx <= data.nTransactionsLastCheckpoint) { double nCheapBefore = pindex->nChainTx; double nCheapAfter = data.nTransactionsLastCheckpoint - pindex->nChainTx; @@ -70,22 +63,19 @@ namespace Checkpoints { return fWorkBefore / (fWorkBefore + fWorkAfter); } - int GetTotalBlocksEstimate() + int GetTotalBlocksEstimate(const CCheckpointData& data) { - if (!fEnabled) - return 0; + const MapCheckpoints& checkpoints = data.mapCheckpoints; - const MapCheckpoints& checkpoints = *Params().Checkpoints().mapCheckpoints; + if (checkpoints.empty()) + return 0; return checkpoints.rbegin()->first; } - CBlockIndex* GetLastCheckpoint() + CBlockIndex* GetLastCheckpoint(const CCheckpointData& data) { - if (!fEnabled) - return NULL; - - const MapCheckpoints& checkpoints = *Params().Checkpoints().mapCheckpoints; + const MapCheckpoints& checkpoints = data.mapCheckpoints; BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints) { |