aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-10-28 14:08:39 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-10-28 14:14:55 +0200
commitd2143dc937e3fc93fd35def25a9c0461f26ccd4f (patch)
tree7d145d1cfaf496b489bcda4491cd93d02fd51c6d /src/wallet
parent0dcb888266ea9e0f091713da456462790fb8b3aa (diff)
parentcfe77ef412776390ec4575f2d5f7230391a4d198 (diff)
Merge #8989: [Qt] overhaul smart-fee slider, adjust default confirmation target
cfe77ef [Qt] overhaul smart-fee slider, adjust default confirmation target (Jonas Schnelli) 6f02899 [Qt] Hide nTxConfirmTarget behind WalletModel (Jonas Schnelli) 004168d CoinControl: add option for custom confirmation target (Jonas Schnelli)
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/coincontrol.h3
-rw-r--r--src/wallet/wallet.cpp9
2 files changed, 10 insertions, 2 deletions
diff --git a/src/wallet/coincontrol.h b/src/wallet/coincontrol.h
index 78516770e6..08d23688ff 100644
--- a/src/wallet/coincontrol.h
+++ b/src/wallet/coincontrol.h
@@ -22,6 +22,8 @@ public:
bool fOverrideFeeRate;
//! Feerate to use if overrideFeeRate is true
CFeeRate nFeeRate;
+ //! Override the default confirmation target, 0 = use default
+ int nConfirmTarget;
CCoinControl()
{
@@ -37,6 +39,7 @@ public:
nMinimumTotalFee = 0;
nFeeRate = CFeeRate(0);
fOverrideFeeRate = false;
+ nConfirmTarget = 0;
}
bool HasSelected() const
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 3fc05c1c1d..c9e926266c 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2434,17 +2434,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;
}