Line data Source code
1 : // Copyright (c) 2019 The Zcash developers 2 : // Copyright (c) 2020-2021 The PIVX Core developers 3 : // Distributed under the MIT software license, see the accompanying 4 : // file COPYING or https://www.opensource.org/licenses/mit-license.php . 5 : 6 : #include "consensus/params.h" 7 : #include "consensus/upgrades.h" 8 : #include "util/system.h" 9 : 10 : namespace Consensus { 11 : 12 3291484 : bool Params::NetworkUpgradeActive(int nHeight, Consensus::UpgradeIndex idx) const 13 : { 14 3291484 : if (idx >= Consensus::MAX_NETWORK_UPGRADES) 15 0 : return error("%s: Upgrade index out of bounds: %d >= %d", 16 0 : __func__, idx, Consensus::MAX_NETWORK_UPGRADES); 17 : 18 3291484 : if (nHeight < 0) 19 11 : return error("%s: Requested state for upgrade %s at negative height %d", 20 11 : __func__, NetworkUpgradeInfo[idx].strName, nHeight); 21 : 22 3291474 : return NetworkUpgradeState(nHeight, *this, idx) == UPGRADE_ACTIVE; 23 : } 24 : 25 5841 : Optional<LLMQParams> Params::GetLLMQParams(uint8_t llmqtype) const 26 : { 27 5841 : const auto it = llmqs.find((LLMQType)llmqtype); 28 5841 : if (it == llmqs.end()) { 29 0 : return nullopt; 30 : } 31 5841 : return Optional<LLMQParams>(it->second); 32 : } 33 : 34 : } // End consensus namespace