Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
fees.cpp
Go to the documentation of this file.
1// Copyright (c) 2009-2010 Satoshi Nakamoto
2// Copyright (c) 2009-2017 The Bitcoin Core developers
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#include <wallet/fees.h>
7
8#include <config.h>
9#include <txmempool.h>
10#include <wallet/coincontrol.h>
11#include <wallet/wallet.h>
12
16
21
23 return std::max(wallet.m_min_fee, wallet.chain().relayMinFee());
24}
25
29 (coin_control.fOverrideFeeRate && coin_control.m_feerate)
30 ? *coin_control.m_feerate
31 : wallet.m_pay_tx_fee;
32
33 if (neededFeeRate == CFeeRate()) {
34 neededFeeRate = wallet.chain().estimateFee();
35 // ... unless we don't have enough mempool data for estimatefee, then
36 // use fallback fee.
37 if (neededFeeRate == CFeeRate()) {
38 neededFeeRate = wallet.m_fallback_fee;
39 }
40 }
41
42 // Prevent user from paying a fee below the min relay fee.
43 return std::max(neededFeeRate, GetRequiredFeeRate(wallet));
44}
Coin Control Features.
Definition coincontrol.h:21
Fee rate in satoshis per kilobyte: Amount / kB.
Definition feerate.h:21
Amount GetFeeCeiling(size_t nBytes) const
Return the ceiling of a fee calculation in satoshis for the given size in bytes.
Definition feerate.cpp:53
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition wallet.h:254
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
Amount GetRequiredFee(const CWallet &wallet, unsigned int nTxBytes)
Return the minimum required absolute fee for this size based on the required fee rate.
Definition fees.cpp:13
Amount GetMinimumFee(const CWallet &wallet, unsigned int nTxBytes, const CCoinControl &coin_control)
Estimate the minimum fee considering user set parameters and the required fee.
Definition fees.cpp:17
CFeeRate GetMinimumFeeRate(const CWallet &wallet, const CCoinControl &coin_control)
Estimate the minimum fee rate considering user set parameters and the required fee.
Definition fees.cpp:26
CFeeRate GetRequiredFeeRate(const CWallet &wallet)
Return the minimum required feerate taking into account the minimum relay feerate and user set minimu...
Definition fees.cpp:22