|
|
@ -2223,14 +2223,9 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge
|
|
|
|
if (nFeeNeeded == 0) {
|
|
|
|
if (nFeeNeeded == 0) {
|
|
|
|
int estimateFoundTarget = nConfirmTarget;
|
|
|
|
int estimateFoundTarget = nConfirmTarget;
|
|
|
|
nFeeNeeded = pool.estimateSmartFee(nConfirmTarget, &estimateFoundTarget).GetFee(nTxBytes);
|
|
|
|
nFeeNeeded = pool.estimateSmartFee(nConfirmTarget, &estimateFoundTarget).GetFee(nTxBytes);
|
|
|
|
// ... unless we don't have enough mempool data for our desired target
|
|
|
|
}
|
|
|
|
// so we make sure we're paying at least minTxFee
|
|
|
|
// prevent user from paying a fee below minRelayTxFee or minTxFee
|
|
|
|
if (nFeeNeeded == 0 || (unsigned int)estimateFoundTarget > nConfirmTarget)
|
|
|
|
nFeeNeeded = std::max(nFeeNeeded, GetRequiredFee(nTxBytes));
|
|
|
|
nFeeNeeded = std::max(nFeeNeeded, GetRequiredFee(nTxBytes));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// prevent user from paying a non-sense fee (like 1 satoshi): 0 < fee < minRelayFee
|
|
|
|
|
|
|
|
if (nFeeNeeded < ::minRelayTxFee.GetFee(nTxBytes))
|
|
|
|
|
|
|
|
nFeeNeeded = ::minRelayTxFee.GetFee(nTxBytes);
|
|
|
|
|
|
|
|
// But always obey the maximum
|
|
|
|
// But always obey the maximum
|
|
|
|
if (nFeeNeeded > maxTxFee)
|
|
|
|
if (nFeeNeeded > maxTxFee)
|
|
|
|
nFeeNeeded = maxTxFee;
|
|
|
|
nFeeNeeded = maxTxFee;
|
|
|
|