Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#include <util/fees.h>7#include <util/strencodings.h>9#include <cassert>10#include <optional>11#include <string_view>13std::string_view FeeRateEstimatorTypeToString(FeeRateEstimatorType feerate_estimator_type)14{15switch (feerate_estimator_type) {16case FeeRateEstimatorType::AUTO:17return "auto";18case FeeRateEstimatorType::BLOCK_POLICY:19return "block_policy";20case FeeRateEstimatorType::MEMPOOL_POLICY:21return "mempool_policy";22}23// no default case, so the compiler can warn about missing cases24assert(false);25}27std::optional<FeeRateEstimatorType> FeeRateEstimatorTypeFromString(std::string_view feerate_estimator_type)28{29const auto normalized{ToLower(feerate_estimator_type)};30if (normalized == "auto") return FeeRateEstimatorType::AUTO;31if (normalized == "block_policy") return FeeRateEstimatorType::BLOCK_POLICY;32if (normalized == "mempool_policy") return FeeRateEstimatorType::MEMPOOL_POLICY;33return std::nullopt;34}