LCOV - code coverage report
Current view: top level - src/util - fees.cpp (source / functions) Coverage Total Hit
Test: fuzz_coverage.info Lines: 93.8 % 16 15
Test Date: 2026-10-23 05:39:29 Functions: 100.0 % 2 2
Branches: 80.0 % 10 8

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 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 <util/fees.h>
       6                 :             : 
       7                 :             : #include <util/strencodings.h>
       8                 :             : 
       9                 :             : #include <cassert>
      10                 :             : #include <optional>
      11                 :             : #include <string_view>
      12                 :             : 
      13                 :         333 : std::string_view FeeRateEstimatorTypeToString(FeeRateEstimatorType feerate_estimator_type)
      14                 :             : {
      15   [ +  +  +  - ]:         333 :     switch (feerate_estimator_type) {
      16                 :         104 :     case FeeRateEstimatorType::AUTO:
      17                 :         104 :         return "auto";
      18                 :           6 :     case FeeRateEstimatorType::BLOCK_POLICY:
      19                 :           6 :         return "block_policy";
      20                 :         223 :     case FeeRateEstimatorType::MEMPOOL_POLICY:
      21                 :         223 :         return "mempool_policy";
      22                 :             :     }
      23                 :             :     // no default case, so the compiler can warn about missing cases
      24                 :           0 :     assert(false);
      25                 :             : }
      26                 :             : 
      27                 :         124 : std::optional<FeeRateEstimatorType> FeeRateEstimatorTypeFromString(std::string_view feerate_estimator_type)
      28                 :             : {
      29                 :         124 :     const auto normalized{ToLower(feerate_estimator_type)};
      30         [ -  + ]:         124 :     if (normalized == "auto") return FeeRateEstimatorType::AUTO;
      31         [ +  + ]:         124 :     if (normalized == "block_policy") return FeeRateEstimatorType::BLOCK_POLICY;
      32         [ +  + ]:         123 :     if (normalized == "mempool_policy") return FeeRateEstimatorType::MEMPOOL_POLICY;
      33                 :         122 :     return std::nullopt;
      34                 :         124 : }
        

Generated by: LCOV version 2.5.0-full