Bitcoin Core
32.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
util
fees.cpp
Go to the documentation of this file.
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
std::string_view
FeeRateEstimatorTypeToString
(
FeeRateEstimatorType
feerate_estimator_type)
14
{
15
switch
(feerate_estimator_type) {
16
case
FeeRateEstimatorType::AUTO
:
17
return
"auto"
;
18
case
FeeRateEstimatorType::BLOCK_POLICY
:
19
return
"block_policy"
;
20
case
FeeRateEstimatorType::MEMPOOL_POLICY
:
21
return
"mempool_policy"
;
22
}
23
// no default case, so the compiler can warn about missing cases
24
assert
(
false
);
25
}
26
27
std::optional<FeeRateEstimatorType>
FeeRateEstimatorTypeFromString
(std::string_view feerate_estimator_type)
28
{
29
const
auto
normalized{
ToLower
(feerate_estimator_type)};
30
if
(normalized ==
"auto"
)
return
FeeRateEstimatorType::AUTO
;
31
if
(normalized ==
"block_policy"
)
return
FeeRateEstimatorType::BLOCK_POLICY
;
32
if
(normalized ==
"mempool_policy"
)
return
FeeRateEstimatorType::MEMPOOL_POLICY
;
33
return
std::nullopt;
34
}
strencodings.h
FeeRateEstimatorTypeToString
std::string_view FeeRateEstimatorTypeToString(FeeRateEstimatorType feerate_estimator_type)
Definition
fees.cpp:13
FeeRateEstimatorTypeFromString
std::optional< FeeRateEstimatorType > FeeRateEstimatorTypeFromString(std::string_view feerate_estimator_type)
Definition
fees.cpp:27
fees.h
FeeRateEstimatorType
FeeRateEstimatorType
Identifier for fee rate estimator.
Definition
fees.h:37
FeeRateEstimatorType::BLOCK_POLICY
@ BLOCK_POLICY
Definition
fees.h:39
FeeRateEstimatorType::MEMPOOL_POLICY
@ MEMPOOL_POLICY
Definition
fees.h:40
FeeRateEstimatorType::AUTO
@ AUTO
Definition
fees.h:38
ToLower
std::string ToLower(std::string_view str)
Returns the lowercase equivalent of the given string.
Definition
strencodings.cpp:362
assert
assert(!tx.IsCoinBase())
Generated on
for Bitcoin Core by
1.18.0