Changeset View
Changeset View
Standalone View
Standalone View
src/consensus/activation.cpp
// Copyright (c) 2018 The Bitcoin developers | // Copyright (c) 2018 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <consensus/activation.h> | #include <consensus/activation.h> | ||||
#include <chain.h> | #include <chain.h> | ||||
#include <chainparams.h> | #include <consensus/params.h> | ||||
#include <config.h> | |||||
#include <util.h> | #include <util.h> | ||||
static bool IsUAHFenabled(const Config &config, int nHeight) { | static bool IsUAHFenabled(const Consensus::Params ¶ms, int nHeight) { | ||||
return nHeight >= config.GetChainParams().GetConsensus().uahfHeight; | return nHeight >= params.uahfHeight; | ||||
} | } | ||||
bool IsUAHFenabled(const Config &config, const CBlockIndex *pindexPrev) { | bool IsUAHFenabled(const Consensus::Params ¶ms, | ||||
const CBlockIndex *pindexPrev) { | |||||
if (pindexPrev == nullptr) { | if (pindexPrev == nullptr) { | ||||
return false; | return false; | ||||
} | } | ||||
return IsUAHFenabled(config, pindexPrev->nHeight); | return IsUAHFenabled(params, pindexPrev->nHeight); | ||||
} | } | ||||
static bool IsDAAEnabled(const Config &config, int nHeight) { | static bool IsDAAEnabled(const Consensus::Params ¶ms, int nHeight) { | ||||
return nHeight >= config.GetChainParams().GetConsensus().daaHeight; | return nHeight >= params.daaHeight; | ||||
} | } | ||||
bool IsDAAEnabled(const Config &config, const CBlockIndex *pindexPrev) { | bool IsDAAEnabled(const Consensus::Params ¶ms, | ||||
const CBlockIndex *pindexPrev) { | |||||
if (pindexPrev == nullptr) { | if (pindexPrev == nullptr) { | ||||
return false; | return false; | ||||
} | } | ||||
return IsDAAEnabled(config, pindexPrev->nHeight); | return IsDAAEnabled(params, pindexPrev->nHeight); | ||||
} | } | ||||
bool IsMagneticAnomalyEnabled(const Config &config, int32_t nHeight) { | bool IsMagneticAnomalyEnabled(const Consensus::Params ¶ms, | ||||
return nHeight >= | int32_t nHeight) { | ||||
config.GetChainParams().GetConsensus().magneticAnomalyHeight; | return nHeight >= params.magneticAnomalyHeight; | ||||
} | } | ||||
bool IsMagneticAnomalyEnabled(const Config &config, | bool IsMagneticAnomalyEnabled(const Consensus::Params ¶ms, | ||||
const CBlockIndex *pindexPrev) { | const CBlockIndex *pindexPrev) { | ||||
if (pindexPrev == nullptr) { | if (pindexPrev == nullptr) { | ||||
return false; | return false; | ||||
} | } | ||||
return IsMagneticAnomalyEnabled(config, pindexPrev->nHeight); | return IsMagneticAnomalyEnabled(params, pindexPrev->nHeight); | ||||
} | } | ||||
bool IsGravitonEnabled(const Config &config, const CBlockIndex *pindexPrev) { | bool IsGravitonEnabled(const Consensus::Params ¶ms, | ||||
const CBlockIndex *pindexPrev) { | |||||
if (pindexPrev == nullptr) { | if (pindexPrev == nullptr) { | ||||
return false; | return false; | ||||
} | } | ||||
return pindexPrev->GetMedianTimePast() >= | return pindexPrev->GetMedianTimePast() >= | ||||
gArgs.GetArg( | gArgs.GetArg("-gravitonactivationtime", | ||||
"-gravitonactivationtime", | params.gravitonActivationTime); | ||||
config.GetChainParams().GetConsensus().gravitonActivationTime); | |||||
} | } |