Branch data Line data Source code
1 : : // Copyright (c) 2016-present The Bitcoin Core developers
2 : : // Distributed under the MIT software license, see the accompanying
3 : : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 : :
5 : : #include <deploymentinfo.h>
6 : :
7 : : #include <consensus/params.h>
8 : :
9 : : #include <string_view>
10 : :
11 : : const std::array<VBDeploymentInfo,Consensus::MAX_VERSION_BITS_DEPLOYMENTS> VersionBitsDeploymentInfo{
12 : : VBDeploymentInfo{
13 : : .name = "testdummy",
14 : : .gbt_optional_rule = true,
15 : : },
16 : : };
17 : :
18 : 10 : std::string DeploymentName(Consensus::BuriedDeployment dep)
19 : : {
20 [ - + ]: 10 : assert(ValidDeployment(dep));
21 [ + + + + : 10 : switch (dep) {
+ - ]
22 : 2 : case Consensus::DEPLOYMENT_HEIGHTINCB:
23 : 2 : return "bip34";
24 : 2 : case Consensus::DEPLOYMENT_CLTV:
25 : 2 : return "bip65";
26 : 2 : case Consensus::DEPLOYMENT_DERSIG:
27 : 2 : return "bip66";
28 : 2 : case Consensus::DEPLOYMENT_CSV:
29 : 2 : return "csv";
30 : 2 : case Consensus::DEPLOYMENT_SEGWIT:
31 : 2 : return "segwit";
32 : : } // no default case, so the compiler can warn about missing cases
33 : 0 : return "";
34 : : }
35 : :
36 : 806 : std::optional<Consensus::BuriedDeployment> GetBuriedDeployment(const std::string_view name)
37 : : {
38 [ - + ]: 806 : if (name == "segwit") {
39 : 0 : return Consensus::BuriedDeployment::DEPLOYMENT_SEGWIT;
40 [ + - ]: 806 : } else if (name == "bip34") {
41 : 806 : return Consensus::BuriedDeployment::DEPLOYMENT_HEIGHTINCB;
42 [ # # ]: 0 : } else if (name == "dersig") {
43 : 0 : return Consensus::BuriedDeployment::DEPLOYMENT_DERSIG;
44 [ # # ]: 0 : } else if (name == "cltv") {
45 : 0 : return Consensus::BuriedDeployment::DEPLOYMENT_CLTV;
46 [ # # ]: 0 : } else if (name == "csv") {
47 : 0 : return Consensus::BuriedDeployment::DEPLOYMENT_CSV;
48 : : }
49 : 0 : return std::nullopt;
50 : : }
|