chainparams: move CCheckpointData into chainparams.h
This unties CChainParams from its dependency on checkpoints. Instead, now it only depends on the raw checkpoint data.
This commit is contained in:
parent
a97308c5d4
commit
47b71cec5d
|
@ -147,7 +147,7 @@ public:
|
|||
fMineBlocksOnDemand = false;
|
||||
fTestnetToBeDeprecatedFieldRPC = false;
|
||||
|
||||
checkpointData = (Checkpoints::CCheckpointData) {
|
||||
checkpointData = (CCheckpointData) {
|
||||
boost::assign::map_list_of
|
||||
(0, consensus.hashGenesisBlock)
|
||||
(2500, uint256S("0x00000006dc968f600be11a86cbfbf7feb61c7577f45caced2e82b6d261d19744"))
|
||||
|
@ -293,7 +293,7 @@ public:
|
|||
fMineBlocksOnDemand = false;
|
||||
fTestnetToBeDeprecatedFieldRPC = true;
|
||||
|
||||
checkpointData = (Checkpoints::CCheckpointData) {
|
||||
checkpointData = (CCheckpointData) {
|
||||
boost::assign::map_list_of
|
||||
(0, consensus.hashGenesisBlock)
|
||||
(38000, uint256S("0x001e9a2d2e2892b88e9998cf7b079b41d59dd085423a921fe8386cecc42287b8")),
|
||||
|
@ -374,7 +374,7 @@ public:
|
|||
fMineBlocksOnDemand = true;
|
||||
fTestnetToBeDeprecatedFieldRPC = false;
|
||||
|
||||
checkpointData = (Checkpoints::CCheckpointData){
|
||||
checkpointData = (CCheckpointData){
|
||||
boost::assign::map_list_of
|
||||
( 0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")),
|
||||
0,
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#define BITCOIN_CHAINPARAMS_H
|
||||
|
||||
#include "chainparamsbase.h"
|
||||
#include "checkpoints.h"
|
||||
#include "consensus/params.h"
|
||||
#include "primitives/block.h"
|
||||
#include "protocol.h"
|
||||
|
@ -24,6 +23,14 @@ struct SeedSpec6 {
|
|||
uint16_t port;
|
||||
};
|
||||
|
||||
typedef std::map<int, uint256> MapCheckpoints;
|
||||
|
||||
struct CCheckpointData {
|
||||
MapCheckpoints mapCheckpoints;
|
||||
int64_t nTimeLastCheckpoint;
|
||||
int64_t nTransactionsLastCheckpoint;
|
||||
double fTransactionsPerDay;
|
||||
};
|
||||
|
||||
/**
|
||||
* CChainParams defines various tweakable parameters of a given instance of the
|
||||
|
@ -75,7 +82,7 @@ public:
|
|||
const std::vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
|
||||
const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
|
||||
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
|
||||
const Checkpoints::CCheckpointData& Checkpoints() const { return checkpointData; }
|
||||
const CCheckpointData& Checkpoints() const { return checkpointData; }
|
||||
/** Return the founder's reward address and script for a given block height */
|
||||
std::string GetFoundersRewardAddressAtHeight(int height) const;
|
||||
CScript GetFoundersRewardScriptAtHeight(int height) const;
|
||||
|
@ -105,7 +112,7 @@ protected:
|
|||
bool fRequireStandard = false;
|
||||
bool fMineBlocksOnDemand = false;
|
||||
bool fTestnetToBeDeprecatedFieldRPC = false;
|
||||
Checkpoints::CCheckpointData checkpointData;
|
||||
CCheckpointData checkpointData;
|
||||
std::vector<std::string> vFoundersRewardAddress;
|
||||
};
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <map>
|
||||
|
||||
class CBlockIndex;
|
||||
struct CCheckpointData;
|
||||
|
||||
/**
|
||||
* Block-chain checkpoints are compiled-in sanity checks.
|
||||
|
@ -17,14 +18,6 @@ class CBlockIndex;
|
|||
*/
|
||||
namespace Checkpoints
|
||||
{
|
||||
typedef std::map<int, uint256> MapCheckpoints;
|
||||
|
||||
struct CCheckpointData {
|
||||
MapCheckpoints mapCheckpoints;
|
||||
int64_t nTimeLastCheckpoint;
|
||||
int64_t nTransactionsLastCheckpoint;
|
||||
double fTransactionsPerDay;
|
||||
};
|
||||
|
||||
//! Return conservative estimate of total number of blocks, 0 if unknown
|
||||
int GetTotalBlocksEstimate(const CCheckpointData& data);
|
||||
|
|
|
@ -22,7 +22,7 @@ BOOST_FIXTURE_TEST_SUITE(Checkpoints_tests, BasicTestingSetup)
|
|||
/*
|
||||
BOOST_AUTO_TEST_CASE(sanity)
|
||||
{
|
||||
const Checkpoints::CCheckpointData& checkpoints = Params(CBaseChainParams::MAIN).Checkpoints();
|
||||
const CCheckpointData& checkpoints = Params(CBaseChainParams::MAIN).Checkpoints();
|
||||
BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate(checkpoints) >= 134444);
|
||||
}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue