mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Change wallet and GUI code to use new smart fee estimation calls.
This commit is contained in:
@@ -2033,14 +2033,10 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
if (fSendFreeTransactions && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE)
|
||||
{
|
||||
// Not enough fee: enough priority?
|
||||
double dPriorityNeeded = mempool.estimatePriority(nTxConfirmTarget);
|
||||
// Not enough mempool history to estimate: use hard-coded AllowFree.
|
||||
if (dPriorityNeeded <= 0 && AllowFree(dPriority))
|
||||
break;
|
||||
|
||||
// Small enough, and priority high enough, to send for free
|
||||
if (dPriorityNeeded > 0 && dPriority >= dPriorityNeeded)
|
||||
break;
|
||||
double dPriorityNeeded = mempool.estimateSmartPriority(nTxConfirmTarget);
|
||||
// Require at least hard-coded AllowFree.
|
||||
if (dPriority >= dPriorityNeeded && AllowFree(dPriority))
|
||||
break;
|
||||
}
|
||||
|
||||
CAmount nFeeNeeded = GetMinimumFee(nBytes, nTxConfirmTarget, mempool);
|
||||
@@ -2131,12 +2127,14 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge
|
||||
if (fPayAtLeastCustomFee && nFeeNeeded > 0 && nFeeNeeded < payTxFee.GetFeePerK())
|
||||
nFeeNeeded = payTxFee.GetFeePerK();
|
||||
// User didn't set: use -txconfirmtarget to estimate...
|
||||
if (nFeeNeeded == 0)
|
||||
nFeeNeeded = pool.estimateFee(nConfirmTarget).GetFee(nTxBytes);
|
||||
// ... unless we don't have enough mempool data, in which case fall
|
||||
// back to the required fee
|
||||
if (nFeeNeeded == 0)
|
||||
nFeeNeeded = GetRequiredFee(nTxBytes);
|
||||
if (nFeeNeeded == 0) {
|
||||
int estimateFoundTarget = nConfirmTarget;
|
||||
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
|
||||
if (nFeeNeeded == 0 || (unsigned int)estimateFoundTarget > nConfirmTarget)
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user