diff --git a/src/consensus/activation.cpp b/src/consensus/activation.cpp index 8b77180ef..f56bdea93 100644 --- a/src/consensus/activation.cpp +++ b/src/consensus/activation.cpp @@ -1,102 +1,113 @@ // Copyright (c) 2018-2019 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 static bool IsUAHFenabled(const Consensus::Params ¶ms, int nHeight) { return nHeight >= params.uahfHeight; } bool IsUAHFenabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev) { if (pindexPrev == nullptr) { return false; } return IsUAHFenabled(params, pindexPrev->nHeight); } static bool IsDAAEnabled(const Consensus::Params ¶ms, int nHeight) { return nHeight >= params.daaHeight; } bool IsDAAEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev) { if (pindexPrev == nullptr) { return false; } return IsDAAEnabled(params, pindexPrev->nHeight); } bool IsMagneticAnomalyEnabled(const Consensus::Params ¶ms, int32_t nHeight) { return nHeight >= params.magneticAnomalyHeight; } bool IsMagneticAnomalyEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev) { if (pindexPrev == nullptr) { return false; } return IsMagneticAnomalyEnabled(params, pindexPrev->nHeight); } static bool IsGravitonEnabled(const Consensus::Params ¶ms, int32_t nHeight) { return nHeight >= params.gravitonHeight; } bool IsGravitonEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev) { if (pindexPrev == nullptr) { return false; } return IsGravitonEnabled(params, pindexPrev->nHeight); } static bool IsPhononEnabled(const Consensus::Params ¶ms, int32_t nHeight) { return nHeight >= params.phononHeight; } bool IsPhononEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev) { if (pindexPrev == nullptr) { return false; } return IsPhononEnabled(params, pindexPrev->nHeight); } static bool IsAxionEnabled(const Consensus::Params ¶ms, int32_t nHeight) { return nHeight >= params.axionHeight; } bool IsAxionEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev) { if (pindexPrev == nullptr) { return false; } return IsAxionEnabled(params, pindexPrev->nHeight); } static bool IsGluonEnabled(const Consensus::Params ¶ms, int32_t nHeight) { return nHeight >= params.gluonHeight; } bool IsGluonEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev) { if (pindexPrev == nullptr) { return false; } return IsGluonEnabled(params, pindexPrev->nHeight); } + +bool IsWellingtonEnabled(const Consensus::Params ¶ms, + const CBlockIndex *pindexPrev) { + if (pindexPrev == nullptr) { + return false; + } + + return pindexPrev->GetMedianTimePast() >= + gArgs.GetIntArg("-wellingtonactivationtime", + params.wellingtonActivationTime); +} diff --git a/src/consensus/activation.h b/src/consensus/activation.h index f9b9716f8..a0376e4e4 100644 --- a/src/consensus/activation.h +++ b/src/consensus/activation.h @@ -1,46 +1,50 @@ // Copyright (c) 2018-2019 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; namespace Consensus { struct Params; } /** Check if UAHF has activated. */ bool IsUAHFenabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev); /** Check if DAA HF has activated. */ bool IsDAAEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev); /** Check if Nov 15, 2018 HF has activated using block height. */ bool IsMagneticAnomalyEnabled(const Consensus::Params ¶ms, int32_t nHeight); /** Check if Nov 15, 2018 HF has activated using previous block index. */ bool IsMagneticAnomalyEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev); /** Check if Nov 15th, 2019 protocol upgrade has activated. */ bool IsGravitonEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev); /** Check if May 15th, 2020 protocol upgrade has activated. */ bool IsPhononEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev); /** Check if November 15th, 2020 protocol upgrade has activated. */ bool IsAxionEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev); /** Check if May 15th, 2022 protocol upgrade has activated. */ bool IsGluonEnabled(const Consensus::Params ¶ms, const CBlockIndex *pindexPrev); +/** Check if May 15th, 2023 protocol upgrade has activated. */ +bool IsWellingtonEnabled(const Consensus::Params ¶ms, + const CBlockIndex *pindexPrev); + #endif // BITCOIN_CONSENSUS_ACTIVATION_H diff --git a/src/init.cpp b/src/init.cpp index 5a69d2c17..4496f7780 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1,3149 +1,3151 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2018 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include #endif #include #include #include #include #include #include // For AVALANCHE_LEGACY_PROOF_DEFAULT #include #include // For AVALANCHE_VOTE_STALE_* #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include