mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
checkpoints: move the checkpoints enable boolean into main
This pertains to app-state, so it doesn't make sense to handle inside the checkpoint functions.
This commit is contained in:
parent
11982d366d
commit
a8cdaf5c96
6 changed files with 26 additions and 27 deletions
|
|
@ -23,13 +23,8 @@ namespace Checkpoints {
|
|||
*/
|
||||
static const double SIGCHECK_VERIFICATION_FACTOR = 5.0;
|
||||
|
||||
bool fEnabled = true;
|
||||
|
||||
bool CheckBlock(const CCheckpointData& data, int nHeight, const uint256& hash)
|
||||
{
|
||||
if (!fEnabled)
|
||||
return true;
|
||||
|
||||
const MapCheckpoints& checkpoints = data.mapCheckpoints;
|
||||
|
||||
MapCheckpoints::const_iterator i = checkpoints.find(nHeight);
|
||||
|
|
@ -69,19 +64,16 @@ namespace Checkpoints {
|
|||
|
||||
int GetTotalBlocksEstimate(const CCheckpointData& data)
|
||||
{
|
||||
if (!fEnabled)
|
||||
return 0;
|
||||
|
||||
const MapCheckpoints& checkpoints = data.mapCheckpoints;
|
||||
|
||||
if (checkpoints.empty())
|
||||
return 0;
|
||||
|
||||
return checkpoints.rbegin()->first;
|
||||
}
|
||||
|
||||
CBlockIndex* GetLastCheckpoint(const CCheckpointData& data)
|
||||
{
|
||||
if (!fEnabled)
|
||||
return NULL;
|
||||
|
||||
const MapCheckpoints& checkpoints = data.mapCheckpoints;
|
||||
|
||||
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue