Skip to content

Commit

Permalink
Refactor GetMinimumFee to give option of providing targetFee
Browse files Browse the repository at this point in the history
  • Loading branch information
morcos committed Jan 26, 2017

Verified

This commit was signed with the committer’s verified signature. The key has expired.
danielleadams Danielle Adams
1 parent fe8e8ef commit ae9719a
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
@@ -2790,8 +2790,13 @@ CAmount CWallet::GetRequiredFee(unsigned int nTxBytes)

CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool)
{
// payTxFee is user-set "I want to pay this much"
CAmount nFeeNeeded = payTxFee.GetFee(nTxBytes);
// payTxFee is the user-set global for desired feerate
return GetMinimumFee(nTxBytes, nConfirmTarget, pool, payTxFee.GetFee(nTxBytes));
}

CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, CAmount targetFee)
{
CAmount nFeeNeeded = targetFee;
// User didn't set: use -txconfirmtarget to estimate...
if (nFeeNeeded == 0) {
int estimateFoundTarget = nConfirmTarget;
5 changes: 5 additions & 0 deletions src/wallet/wallet.h
Original file line number Diff line number Diff line change
@@ -802,6 +802,11 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
* and the required fee
*/
static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool);
/**
* Estimate the minimum fee considering required fee and targetFee or if 0
* then fee estimation for nConfirmTarget
*/
static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, CAmount targetFee);
/**
* Return the minimum required fee taking into account the
* floating relay fee and user set minimum transaction fee

0 comments on commit ae9719a

Please sign in to comment.