Skip to content

Commit ae9719a

Browse files
committed
Refactor GetMinimumFee to give option of providing targetFee
1 parent fe8e8ef commit ae9719a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/wallet/wallet.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2790,8 +2790,13 @@ CAmount CWallet::GetRequiredFee(unsigned int nTxBytes)
27902790

27912791
CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool)
27922792
{
2793-
// payTxFee is user-set "I want to pay this much"
2794-
CAmount nFeeNeeded = payTxFee.GetFee(nTxBytes);
2793+
// payTxFee is the user-set global for desired feerate
2794+
return GetMinimumFee(nTxBytes, nConfirmTarget, pool, payTxFee.GetFee(nTxBytes));
2795+
}
2796+
2797+
CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, CAmount targetFee)
2798+
{
2799+
CAmount nFeeNeeded = targetFee;
27952800
// User didn't set: use -txconfirmtarget to estimate...
27962801
if (nFeeNeeded == 0) {
27972802
int estimateFoundTarget = nConfirmTarget;

src/wallet/wallet.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,11 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
802802
* and the required fee
803803
*/
804804
static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool);
805+
/**
806+
* Estimate the minimum fee considering required fee and targetFee or if 0
807+
* then fee estimation for nConfirmTarget
808+
*/
809+
static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, CAmount targetFee);
805810
/**
806811
* Return the minimum required fee taking into account the
807812
* floating relay fee and user set minimum transaction fee

0 commit comments

Comments
 (0)