Merge pull request #6055
a8cdaf5checkpoints: move the checkpoints enable boolean into main (Cory Fields)11982d3checkpoints: Decouple checkpoints from Params (Cory Fields)6996823checkpoints: make checkpoints a member of CChainParams (Cory Fields)9f13a10checkpoints: store mapCheckpoints in CCheckpointData rather than a pointer (Cory Fields)
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user