diff --git a/src/deploymentinfo.cpp b/src/deploymentinfo.cpp index 12048442e..50a7116a7 100644 --- a/src/deploymentinfo.cpp +++ b/src/deploymentinfo.cpp @@ -1,15 +1,32 @@ // Copyright (c) 2016-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. #include #include const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS] = { { /*.name =*/"testdummy", /*.gbt_force =*/true, }, }; + +[[maybe_unused]] std::string DeploymentName(Consensus::BuriedDeployment dep) { + assert(ValidDeployment(dep)); + switch (dep) { + case Consensus::DEPLOYMENT_P2SH: + return "bip22"; + case Consensus::DEPLOYMENT_HEIGHTINCB: + return "bip34"; + case Consensus::DEPLOYMENT_CLTV: + return "bip65"; + case Consensus::DEPLOYMENT_DERSIG: + return "bip66"; + case Consensus::DEPLOYMENT_CSV: + return "csv"; + } // no default case, so the compiler can warn about missing cases + return ""; +} diff --git a/src/deploymentinfo.h b/src/deploymentinfo.h index 4c68856ea..116be1c8d 100644 --- a/src/deploymentinfo.h +++ b/src/deploymentinfo.h @@ -1,17 +1,29 @@ // Copyright (c) 2016-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. #ifndef BITCOIN_DEPLOYMENTINFO_H #define BITCOIN_DEPLOYMENTINFO_H +#include + +#include + struct VBDeploymentInfo { /** Deployment name */ const char *name; /** Whether GBT clients can safely ignore this rule in simplified usage */ bool gbt_force; }; -extern const struct VBDeploymentInfo VersionBitsDeploymentInfo[]; +extern const VBDeploymentInfo + VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS]; + +[[maybe_unused]] std::string DeploymentName(Consensus::BuriedDeployment dep); + +inline std::string DeploymentName(Consensus::DeploymentPos pos) { + assert(Consensus::ValidDeployment(pos)); + return VersionBitsDeploymentInfo[pos].name; +} #endif // BITCOIN_DEPLOYMENTINFO_H diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 496fa87cd..cd0aa0afd 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1,3327 +1,3350 @@ // Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2019 The Bitcoin Core 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 // For VersionBitsDeploymentInfo +#include #include #include #include #include #include #include #include #include #include #include #include #include #include