diff --git a/src/consensus/activation.cpp b/src/consensus/activation.cpp index d20544e4f..d8e338327 100644 --- a/src/consensus/activation.cpp +++ b/src/consensus/activation.cpp @@ -1,59 +1,60 @@ // Copyright (c) 2018 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include -#include -#include +#include #include -static bool IsUAHFenabled(const Config &config, int nHeight) { - return nHeight >= config.GetChainParams().GetConsensus().uahfHeight; +static bool IsUAHFenabled(const Consensus::Params ¶ms, int nHeight) { + return nHeight >= params.uahfHeight; } -bool IsUAHFenabled(const Config &config, const CBlockIndex *pindexPrev) { +bool IsUAHFenabled(const Consensus::Params ¶ms, + const CBlockIndex *pindexPrev) { if (pindexPrev == nullptr) { return false; } - return IsUAHFenabled(config, pindexPrev->nHeight); + return IsUAHFenabled(params, pindexPrev->nHeight); } -static bool IsDAAEnabled(const Config &config, int nHeight) { - return nHeight >= config.GetChainParams().GetConsensus().daaHeight; +static bool IsDAAEnabled(const Consensus::Params ¶ms, int nHeight) { + return nHeight >= params.daaHeight; } -bool IsDAAEnabled(const Config &config, const CBlockIndex *pindexPrev) { +bool IsDAAEnabled(const Consensus::Params ¶ms, + const CBlockIndex *pindexPrev) { if (pindexPrev == nullptr) { return false; } - return IsDAAEnabled(config, pindexPrev->nHeight); + return IsDAAEnabled(params, pindexPrev->nHeight); } -bool IsMagneticAnomalyEnabled(const Config &config, int32_t nHeight) { - return nHeight >= - config.GetChainParams().GetConsensus().magneticAnomalyHeight; +bool IsMagneticAnomalyEnabled(const Consensus::Params ¶ms, + int32_t nHeight) { + return nHeight >= params.magneticAnomalyHeight; } -bool IsMagneticAnomalyEnabled(const Config &config, +bool IsMagneticAnomalyEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev) { if (pindexPrev == nullptr) { 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) { return false; } return pindexPrev->GetMedianTimePast() >= - gArgs.GetArg( - "-gravitonactivationtime", - config.GetChainParams().GetConsensus().gravitonActivationTime); + gArgs.GetArg("-gravitonactivationtime", + params.gravitonActivationTime); } diff --git a/src/consensus/activation.h b/src/consensus/activation.h index f23e82d03..2fd3628cf 100644 --- a/src/consensus/activation.h +++ b/src/consensus/activation.h @@ -1,28 +1,35 @@ // Copyright (c) 2018 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CONSENSUS_ACTIVATION_H #define BITCOIN_CONSENSUS_ACTIVATION_H #include class CBlockIndex; class Config; +namespace Consensus { +struct Params; +} + /** Check if UAHF has activated. */ -bool IsUAHFenabled(const Config &config, const CBlockIndex *pindexPrev); +bool IsUAHFenabled(const Consensus::Params ¶ms, + const CBlockIndex *pindexPrev); /** Check if DAA HF has activated. */ -bool IsDAAEnabled(const Config &config, const CBlockIndex *pindexPrev); +bool IsDAAEnabled(const Consensus::Params ¶ms, + const CBlockIndex *pindexPrev); /** Check if Nov 15, 2018 HF has activated using block height. */ -bool IsMagneticAnomalyEnabled(const Config &config, int32_t nHeight); +bool IsMagneticAnomalyEnabled(const Consensus::Params ¶ms, int32_t nHeight); /** Check if Nov 15, 2018 HF has activated using previous block index. */ -bool IsMagneticAnomalyEnabled(const Config &config, +bool IsMagneticAnomalyEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev); /** Check if Nov 15th, 2019 protocol upgrade has activated. */ -bool IsGravitonEnabled(const Config &config, const CBlockIndex *pindexPrev); +bool IsGravitonEnabled(const Consensus::Params ¶ms, + const CBlockIndex *pindexPrev); #endif // BITCOIN_CONSENSUS_ACTIVATION_H diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp index c8501339b..99f647a7b 100644 --- a/src/consensus/tx_verify.cpp +++ b/src/consensus/tx_verify.cpp @@ -1,331 +1,334 @@ // Copyright (c) 2018 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include #include +#include #include +#include #include #include #include #include #include