Skip to content

Commit 3edbd79

Browse files
committed
cleanup: reduce to one GetMinimumFee call signature
1 parent cf57825 commit 3edbd79

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

src/wallet/feebumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ CFeeBumper::CFeeBumper(const CWallet *pWallet, const uint256 txidIn, int newConf
160160
} else {
161161
// if user specified a confirm target then don't consider any global payTxFee
162162
if (specifiedConfirmTarget) {
163-
nNewFee = CWallet::GetMinimumFee(maxNewTxSize, newConfirmTarget, mempool, ::feeEstimator, CAmount(0));
163+
nNewFee = CWallet::GetMinimumFee(maxNewTxSize, newConfirmTarget, mempool, ::feeEstimator, true);
164164
}
165165
// otherwise use the regular wallet logic to select payTxFee or default confirm target
166166
else {

src/wallet/wallet.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,17 +2777,12 @@ CAmount CWallet::GetRequiredFee(unsigned int nTxBytes)
27772777
return std::max(minTxFee.GetFee(nTxBytes), ::minRelayTxFee.GetFee(nTxBytes));
27782778
}
27792779

2780-
CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator)
2780+
CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator, bool ignoreUserSetFee)
27812781
{
27822782
// payTxFee is the user-set global for desired feerate
2783-
return GetMinimumFee(nTxBytes, nConfirmTarget, pool, estimator, payTxFee.GetFee(nTxBytes));
2784-
}
2785-
2786-
CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator, CAmount targetFee)
2787-
{
2788-
CAmount nFeeNeeded = targetFee;
2783+
CAmount nFeeNeeded = payTxFee.GetFee(nTxBytes);
27892784
// User didn't set: use -txconfirmtarget to estimate...
2790-
if (nFeeNeeded == 0) {
2785+
if (nFeeNeeded == 0 || ignoreUserSetFee) {
27912786
int estimateFoundTarget = nConfirmTarget;
27922787
nFeeNeeded = estimator.estimateSmartFee(nConfirmTarget, &estimateFoundTarget, pool).GetFee(nTxBytes);
27932788
// ... unless we don't have enough mempool data for estimatefee, then use fallbackFee

src/wallet/wallet.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -945,12 +945,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
945945
* Estimate the minimum fee considering user set parameters
946946
* and the required fee
947947
*/
948-
static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator);
949-
/**
950-
* Estimate the minimum fee considering required fee and targetFee or if 0
951-
* then fee estimation for nConfirmTarget
952-
*/
953-
static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator, CAmount targetFee);
948+
static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator, bool ignoreUserSetFee = false);
954949
/**
955950
* Return the minimum required fee taking into account the
956951
* floating relay fee and user set minimum transaction fee

0 commit comments

Comments
 (0)