/bitcoin/src/deploymentinfo.cpp
Line | Count | Source |
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 | | std::string DeploymentName(Consensus::BuriedDeployment dep) |
19 | 0 | { |
20 | 0 | assert(ValidDeployment(dep)); Branch (20:5): [True: 0, False: 0]
|
21 | 0 | switch (dep) { Branch (21:13): [True: 0, False: 0]
|
22 | 0 | case Consensus::DEPLOYMENT_HEIGHTINCB: Branch (22:5): [True: 0, False: 0]
|
23 | 0 | return "bip34"; |
24 | 0 | case Consensus::DEPLOYMENT_CLTV: Branch (24:5): [True: 0, False: 0]
|
25 | 0 | return "bip65"; |
26 | 0 | case Consensus::DEPLOYMENT_DERSIG: Branch (26:5): [True: 0, False: 0]
|
27 | 0 | return "bip66"; |
28 | 0 | case Consensus::DEPLOYMENT_CSV: Branch (28:5): [True: 0, False: 0]
|
29 | 0 | return "csv"; |
30 | 0 | case Consensus::DEPLOYMENT_SEGWIT: Branch (30:5): [True: 0, False: 0]
|
31 | 0 | return "segwit"; |
32 | 0 | } // no default case, so the compiler can warn about missing cases |
33 | 0 | return ""; |
34 | 0 | } |
35 | | |
36 | | std::optional<Consensus::BuriedDeployment> GetBuriedDeployment(const std::string_view name) |
37 | 0 | { |
38 | 0 | if (name == "segwit") { Branch (38:9): [True: 0, False: 0]
|
39 | 0 | return Consensus::BuriedDeployment::DEPLOYMENT_SEGWIT; |
40 | 0 | } else if (name == "bip34") { Branch (40:16): [True: 0, False: 0]
|
41 | 0 | return Consensus::BuriedDeployment::DEPLOYMENT_HEIGHTINCB; |
42 | 0 | } else if (name == "dersig") { Branch (42:16): [True: 0, False: 0]
|
43 | 0 | return Consensus::BuriedDeployment::DEPLOYMENT_DERSIG; |
44 | 0 | } else if (name == "cltv") { Branch (44:16): [True: 0, False: 0]
|
45 | 0 | return Consensus::BuriedDeployment::DEPLOYMENT_CLTV; |
46 | 0 | } else if (name == "csv") { Branch (46:16): [True: 0, False: 0]
|
47 | 0 | return Consensus::BuriedDeployment::DEPLOYMENT_CSV; |
48 | 0 | } |
49 | 0 | return std::nullopt; |
50 | 0 | } |