aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2017-04-27 09:09:28 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2017-04-27 09:25:24 -0700
commita550f6e415fd8aec8c45d4704712a408c37ecd18 (patch)
tree6d1d37389c4094a5c34da71553c4eb892159088c
parent47535d7c3ec79c5978cdcc03a5351ddbbb22538d (diff)
parent3edbd79a65334bbb99e11ac68532421ee2930a8a (diff)
Merge #10283: Cleanup: reduce to one GetMinimumFee call signature
3edbd79 cleanup: reduce to one GetMinimumFee call signature (Alex Morcos) Tree-SHA512: da7ae6f0eb06db630792243a47c95d4ceff3baf0ce1ebefa73f1eb6cab1c6fdf0a000770cf61700dd7a9e260d7a313083b79e1d667bd5cbef0b1fe8fbec411e7
-rw-r--r--src/wallet/feebumper.cpp2
-rw-r--r--src/wallet/wallet.cpp11
-rw-r--r--src/wallet/wallet.h7
3 files changed, 5 insertions, 15 deletions
diff --git a/src/wallet/feebumper.cpp b/src/wallet/feebumper.cpp
index 82e5974065..f5b63c1ecd 100644
--- a/src/wallet/feebumper.cpp
+++ b/src/wallet/feebumper.cpp
@@ -160,7 +160,7 @@ CFeeBumper::CFeeBumper(const CWallet *pWallet, const uint256 txidIn, int newConf
} else {
// if user specified a confirm target then don't consider any global payTxFee
if (specifiedConfirmTarget) {
- nNewFee = CWallet::GetMinimumFee(maxNewTxSize, newConfirmTarget, mempool, ::feeEstimator, CAmount(0));
+ nNewFee = CWallet::GetMinimumFee(maxNewTxSize, newConfirmTarget, mempool, ::feeEstimator, true);
}
// otherwise use the regular wallet logic to select payTxFee or default confirm target
else {
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 03659f50b2..e53ac21c9a 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2777,17 +2777,12 @@ CAmount CWallet::GetRequiredFee(unsigned int nTxBytes)
return std::max(minTxFee.GetFee(nTxBytes), ::minRelayTxFee.GetFee(nTxBytes));
}
-CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator)
+CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator, bool ignoreUserSetFee)
{
// payTxFee is the user-set global for desired feerate
- return GetMinimumFee(nTxBytes, nConfirmTarget, pool, estimator, payTxFee.GetFee(nTxBytes));
-}
-
-CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator, CAmount targetFee)
-{
- CAmount nFeeNeeded = targetFee;
+ CAmount nFeeNeeded = payTxFee.GetFee(nTxBytes);
// User didn't set: use -txconfirmtarget to estimate...
- if (nFeeNeeded == 0) {
+ if (nFeeNeeded == 0 || ignoreUserSetFee) {
int estimateFoundTarget = nConfirmTarget;
nFeeNeeded = estimator.estimateSmartFee(nConfirmTarget, &estimateFoundTarget, pool).GetFee(nTxBytes);
// ... unless we don't have enough mempool data for estimatefee, then use fallbackFee
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 6710c39ce2..8015cc8492 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -945,12 +945,7 @@ public:
* Estimate the minimum fee considering user set parameters
* and the required fee
*/
- static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator);
- /**
- * 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, const CBlockPolicyEstimator& estimator, CAmount targetFee);
+ static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, const CBlockPolicyEstimator& estimator, bool ignoreUserSetFee = false);
/**
* Return the minimum required fee taking into account the
* floating relay fee and user set minimum transaction fee