LCOV - code coverage report
Current view: top level - src - deploymentinfo.cpp (source / functions) Coverage Total Hit
Test: fuzz_coverage.info Lines: 65.4 % 26 17
Test Date: 2024-11-04 04:15:01 Functions: 100.0 % 2 2
Branches: 44.4 % 18 8

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2016-2021 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 struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS] = {
      12                 :             :     {
      13                 :             :         /*.name =*/ "testdummy",
      14                 :             :         /*.gbt_force =*/ true,
      15                 :             :     },
      16                 :             :     {
      17                 :             :         /*.name =*/ "taproot",
      18                 :             :         /*.gbt_force =*/ true,
      19                 :             :     },
      20                 :             : };
      21                 :             : 
      22                 :          15 : std::string DeploymentName(Consensus::BuriedDeployment dep)
      23                 :             : {
      24         [ -  + ]:          15 :     assert(ValidDeployment(dep));
      25   [ +  +  +  +  :          15 :     switch (dep) {
                   +  - ]
      26                 :           3 :     case Consensus::DEPLOYMENT_HEIGHTINCB:
      27                 :           3 :         return "bip34";
      28                 :           3 :     case Consensus::DEPLOYMENT_CLTV:
      29                 :           3 :         return "bip65";
      30                 :           3 :     case Consensus::DEPLOYMENT_DERSIG:
      31                 :           3 :         return "bip66";
      32                 :           3 :     case Consensus::DEPLOYMENT_CSV:
      33                 :           3 :         return "csv";
      34                 :           3 :     case Consensus::DEPLOYMENT_SEGWIT:
      35                 :           3 :         return "segwit";
      36                 :             :     } // no default case, so the compiler can warn about missing cases
      37                 :           0 :     return "";
      38                 :             : }
      39                 :             : 
      40                 :        2297 : std::optional<Consensus::BuriedDeployment> GetBuriedDeployment(const std::string_view name)
      41                 :             : {
      42         [ -  + ]:        2297 :     if (name == "segwit") {
      43                 :           0 :         return Consensus::BuriedDeployment::DEPLOYMENT_SEGWIT;
      44         [ +  - ]:        2297 :     } else if (name == "bip34") {
      45                 :        2297 :         return Consensus::BuriedDeployment::DEPLOYMENT_HEIGHTINCB;
      46         [ #  # ]:           0 :     } else if (name == "dersig") {
      47                 :           0 :         return Consensus::BuriedDeployment::DEPLOYMENT_DERSIG;
      48         [ #  # ]:           0 :     } else if (name == "cltv") {
      49                 :           0 :         return Consensus::BuriedDeployment::DEPLOYMENT_CLTV;
      50         [ #  # ]:           0 :     } else if (name == "csv") {
      51                 :           0 :         return Consensus::BuriedDeployment::DEPLOYMENT_CSV;
      52                 :             :     }
      53                 :           0 :     return std::nullopt;
      54                 :             : }
        

Generated by: LCOV version 2.0-1