mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
CoinControl: add option for custom confirmation target
This commit is contained in:
@@ -2433,17 +2433,22 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
|
||||
dPriority = wtxNew.ComputePriority(dPriority, nBytes);
|
||||
|
||||
// Allow to override the default confirmation target over the CoinControl instance
|
||||
int currentConfirmationTarget = nTxConfirmTarget;
|
||||
if (coinControl && coinControl->nConfirmTarget > 0)
|
||||
currentConfirmationTarget = coinControl->nConfirmTarget;
|
||||
|
||||
// Can we complete this as a free transaction?
|
||||
if (fSendFreeTransactions && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE)
|
||||
{
|
||||
// Not enough fee: enough priority?
|
||||
double dPriorityNeeded = mempool.estimateSmartPriority(nTxConfirmTarget);
|
||||
double dPriorityNeeded = mempool.estimateSmartPriority(currentConfirmationTarget);
|
||||
// Require at least hard-coded AllowFree.
|
||||
if (dPriority >= dPriorityNeeded && AllowFree(dPriority))
|
||||
break;
|
||||
}
|
||||
|
||||
CAmount nFeeNeeded = GetMinimumFee(nBytes, nTxConfirmTarget, mempool);
|
||||
CAmount nFeeNeeded = GetMinimumFee(nBytes, currentConfirmationTarget, mempool);
|
||||
if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) {
|
||||
nFeeNeeded = coinControl->nMinimumTotalFee;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user