Refactor GetMinimumFee to give option of providing targetFee
This commit is contained in:
parent
fe8e8efcf9
commit
ae9719ab87
2 changed files with 12 additions and 2 deletions
|
@ -2790,8 +2790,13 @@ CAmount CWallet::GetRequiredFee(unsigned int nTxBytes)
|
||||||
|
|
||||||
CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool)
|
CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool)
|
||||||
{
|
{
|
||||||
// payTxFee is user-set "I want to pay this much"
|
// payTxFee is the user-set global for desired feerate
|
||||||
CAmount nFeeNeeded = payTxFee.GetFee(nTxBytes);
|
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...
|
// User didn't set: use -txconfirmtarget to estimate...
|
||||||
if (nFeeNeeded == 0) {
|
if (nFeeNeeded == 0) {
|
||||||
int estimateFoundTarget = nConfirmTarget;
|
int estimateFoundTarget = nConfirmTarget;
|
||||||
|
|
|
@ -802,6 +802,11 @@ public:
|
||||||
* and the required fee
|
* and the required fee
|
||||||
*/
|
*/
|
||||||
static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool);
|
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
|
* Return the minimum required fee taking into account the
|
||||||
* floating relay fee and user set minimum transaction fee
|
* floating relay fee and user set minimum transaction fee
|
||||||
|
|
Loading…
Reference in a new issue