mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Merge pull request #6134
e304432Pass reference to estimateSmartFee and cleanup whitespace (Suhas Daftuar)56106a3Expose RPC calls for estimatesmart functions (Alex Morcos)e93a236add estimateSmartFee to the unit test (Alex Morcos)6303051EstimateSmart functions consider mempool min fee (Alex Morcos)f22ac4aIncrease success threshold for fee estimation to 95% (Alex Morcos)4fe2823Change wallet and GUI code to use new smart fee estimation calls. (Alex Morcos)22eca7dAdd smart fee estimation functions (Alex Morcos)
This commit is contained in:
@@ -2010,13 +2010,9 @@ 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)
|
||||
double dPriorityNeeded = mempool.estimateSmartPriority(nTxConfirmTarget);
|
||||
// Require at least hard-coded AllowFree.
|
||||
if (dPriority >= dPriorityNeeded && AllowFree(dPriority))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2120,12 +2116,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