mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 13:42:10 +02:00
The block policy estimator's FeeReason enum mixed two unrelated concerns: the threshold that produced an estimateSmartFee result (NONE, HALF_ESTIMATE, ...) and the reason the wallet selected a fee rate (FALLBACK, MEMPOOL_MIN, REQUIRED). Split them so each layer owns the reasons it reports: - Add a wallet-facing FeeReason enum with the reasons the wallet can select a fee rate: FEE_RATE_ESTIMATOR, MEMPOOL_MIN, USER_SPECIFIED, FALLBACK, and REQUIRED. - Rename the estimator enum to BlockPolicyEstimateReason and narrow it to estimator reasons: NONE, HALF_ESTIMATE, FULL_ESTIMATE, DOUBLE_ESTIMATE, and CONSERVATIVE. - Return wallet fee selection metadata through MinimumFeeRateResult instead of exposing FeeCalculation to wallet callers. The returned target is now optional and is only set for fee rate estimator results. Flatten GetMinimumFeeRate() with early returns while preserving the fee selection order: user feerate still only applies the required-fee check, while smart-fee results keep fallback, mempool-min, and required fallbacks. The returned target is cleared for fallback, mempool-min, and required results. Replace the CreateTransactionInternal log with a simpler message that does not depend on estimateSmartFee internals. Detailed estimator logging will be added in a follow-up commit.
48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
// Copyright (c) 2009-present The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_WALLET_FEES_H
|
|
#define BITCOIN_WALLET_FEES_H
|
|
|
|
#include <consensus/amount.h>
|
|
#include <wallet/types.h>
|
|
|
|
class CFeeRate;
|
|
|
|
namespace wallet {
|
|
class CCoinControl;
|
|
class CWallet;
|
|
|
|
/**
|
|
* Return the minimum required absolute fee for this size
|
|
* based on the required fee rate
|
|
*/
|
|
CAmount GetRequiredFee(const CWallet& wallet, unsigned int nTxBytes);
|
|
|
|
/**
|
|
* Return the minimum fee for this size given a fee rate result.
|
|
*/
|
|
CAmount GetMinimumFee(const MinimumFeeRateResult& min_fee_rate, unsigned int nTxBytes);
|
|
|
|
/**
|
|
* Return the minimum required feerate taking into account the
|
|
* minimum relay feerate and user set minimum transaction feerate
|
|
*/
|
|
CFeeRate GetRequiredFeeRate(const CWallet& wallet);
|
|
|
|
/**
|
|
* Estimate the minimum fee rate considering user set parameters
|
|
* and the required fee
|
|
*/
|
|
MinimumFeeRateResult GetMinimumFeeRate(const CWallet& wallet, const CCoinControl& coin_control);
|
|
|
|
/**
|
|
* Return the maximum feerate for discarding change.
|
|
*/
|
|
CFeeRate GetDiscardRate(const CWallet& wallet);
|
|
} // namespace wallet
|
|
|
|
#endif // BITCOIN_WALLET_FEES_H
|