aboutsummaryrefslogtreecommitdiff
path: root/src/checkpoints.cpp
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2015-04-22 18:19:11 -0400
committerCory Fields <cory-nospam-@coryfields.com>2015-04-30 23:14:48 -0400
commit11982d366df0301b8ceb6e9ec5bdc5a713be9ff0 (patch)
treedfa369ef18c30da6225ea06dede31c0c8bd3ff87 /src/checkpoints.cpp
parent699682304f8f81035fed0c8644a364b7b1b25912 (diff)
checkpoints: Decouple checkpoints from Params
Pass checkpoint data in as necessary
Diffstat (limited to 'src/checkpoints.cpp')
-rw-r--r--src/checkpoints.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp
index 97ea8e2fee..3780899632 100644
--- a/src/checkpoints.cpp
+++ b/src/checkpoints.cpp
@@ -25,12 +25,12 @@ namespace Checkpoints {
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;
@@ -38,7 +38,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;
@@ -50,8 +50,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;
@@ -69,22 +67,22 @@ namespace Checkpoints {
return fWorkBefore / (fWorkBefore + fWorkAfter);
}
- int GetTotalBlocksEstimate()
+ int GetTotalBlocksEstimate(const CCheckpointData& data)
{
if (!fEnabled)
return 0;
- const MapCheckpoints& checkpoints = Params().Checkpoints().mapCheckpoints;
+ const MapCheckpoints& checkpoints = data.mapCheckpoints;
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)
{