LCOV - code coverage report
Current view: top level - src/util - fees.cpp (source / functions) Coverage Total Hit
Test: total_coverage.info Lines: 92.9 % 14 13
Test Date: 2026-08-25 06:30:02 Functions: 100.0 % 2 2
Branches: 87.5 % 8 7

             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 <string_view>
      11                 :             : 
      12                 :        9167 : std::string_view FeeRateEstimatorTypeToString(FeeRateEstimatorType feerate_estimator_type)
      13                 :             : {
      14   [ +  +  +  - ]:        9167 :     switch (feerate_estimator_type) {
      15                 :           1 :     case FeeRateEstimatorType::NONE:
      16                 :           1 :         return "none";
      17                 :         296 :     case FeeRateEstimatorType::BLOCK_POLICY:
      18                 :         296 :         return "block_policy";
      19                 :        8870 :     case FeeRateEstimatorType::MEMPOOL_POLICY:
      20                 :        8870 :         return "mempool_policy";
      21                 :             :     }
      22                 :             :     // no default case, so the compiler can warn about missing cases
      23                 :           0 :     assert(false);
      24                 :             : }
      25                 :             : 
      26                 :         191 : FeeRateEstimatorType FeeRateEstimatorTypeFromString(std::string_view feerate_estimator_type)
      27                 :             : {
      28                 :         191 :     const auto normalized{ToLower(feerate_estimator_type)};
      29         [ +  + ]:         191 :     if (normalized == "block_policy") return FeeRateEstimatorType::BLOCK_POLICY;
      30         [ +  + ]:          18 :     if (normalized == "mempool_policy") return FeeRateEstimatorType::MEMPOOL_POLICY;
      31                 :             :     return FeeRateEstimatorType::NONE;
      32                 :         191 : }
        

Generated by: LCOV version 2.0-1