diff options
author | Alex Morcos <morcos@chaincode.com> | 2017-06-28 17:23:46 -0400 |
---|---|---|
committer | Alex Morcos <morcos@chaincode.com> | 2017-07-14 23:10:58 -0400 |
commit | 03ee70116189bb358e7c6224ba0ecb745e8161c2 (patch) | |
tree | da101ee895880747adc65a5d2d0d439613ce631a /src/qt | |
parent | ecd81dfa3cae4cc1ae3638becfbefc76829ada04 (diff) |
Refactor to use CoinControl in GetMinimumFee and FeeBumper
Improve parameter precedence in coin_control
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/coincontroldialog.cpp | 4 | ||||
-rw-r--r-- | src/qt/sendcoinsdialog.cpp | 14 | ||||
-rw-r--r-- | src/qt/walletmodel.cpp | 5 |
3 files changed, 13 insertions, 10 deletions
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index c19420beb5..7d8ef6571f 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -512,7 +512,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) nBytes -= 34; // Fee - nPayFee = CWallet::GetMinimumFee(nBytes, coinControl->nConfirmTarget, ::mempool, ::feeEstimator, nullptr /* FeeCalculation */, false /* ignoreGlobalPayTxFee */, conservative_estimate); + nPayFee = CWallet::GetMinimumFee(nBytes, *coinControl, ::mempool, ::feeEstimator, nullptr /* FeeCalculation */); if (nPayAmount > 0) { @@ -587,7 +587,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) if (payTxFee.GetFeePerK() > 0) dFeeVary = (double)std::max(CWallet::GetRequiredFee(1000), payTxFee.GetFeePerK()) / 1000; else { - dFeeVary = (double)std::max(CWallet::GetRequiredFee(1000), ::feeEstimator.estimateSmartFee(coinControl->nConfirmTarget, NULL, ::mempool, conservative_estimate).GetFeePerK()) / 1000; + dFeeVary = (double)std::max(CWallet::GetRequiredFee(1000), ::feeEstimator.estimateSmartFee(*coinControl->m_confirm_target, NULL, ::mempool, conservative_estimate).GetFeePerK()) / 1000; } QString toolTip4 = tr("Can vary +/- %1 satoshi(s) per input.").arg(dFeeVary); diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 1a07d466bf..92478fcac6 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -274,11 +274,11 @@ void SendCoinsDialog::on_sendButton_clicked() CCoinControl ctrl; if (model->getOptionsModel()->getCoinControlFeatures()) ctrl = *CoinControlDialog::coinControl; - if (ui->radioSmartFee->isChecked()) - ctrl.nConfirmTarget = getConfTargetForIndex(ui->confTargetSelector->currentIndex()); - else - ctrl.nConfirmTarget = 0; - + if (ui->radioSmartFee->isChecked()) { + ctrl.m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex()); + } else { + ctrl.m_confirm_target = boost::none; + } ctrl.signalRbf = ui->optInRBF->isChecked(); prepareStatus = model->prepareTransaction(currentTransaction, ctrl); @@ -848,9 +848,9 @@ void SendCoinsDialog::coinControlUpdateLabels() CoinControlDialog::payAmounts.clear(); CoinControlDialog::fSubtractFeeFromAmount = false; if (ui->radioSmartFee->isChecked()) { - CoinControlDialog::coinControl->nConfirmTarget = getConfTargetForIndex(ui->confTargetSelector->currentIndex()); + CoinControlDialog::coinControl->m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex()); } else { - CoinControlDialog::coinControl->nConfirmTarget = model->getDefaultConfirmTarget(); + CoinControlDialog::coinControl->m_confirm_target = boost::none; } CoinControlDialog::coinControl->signalRbf = ui->optInRBF->isChecked(); diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 3f90860cc1..ba0e1da0c7 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -24,6 +24,7 @@ #include "sync.h" #include "ui_interface.h" #include "util.h" // for GetBoolArg +#include "wallet/coincontrol.h" #include "wallet/feebumper.h" #include "wallet/wallet.h" #include "wallet/walletdb.h" // for BackupWallet @@ -667,8 +668,10 @@ bool WalletModel::bumpFee(uint256 hash) { std::unique_ptr<CFeeBumper> feeBump; { + CCoinControl coin_control; + coin_control.signalRbf = true; LOCK2(cs_main, wallet->cs_wallet); - feeBump.reset(new CFeeBumper(wallet, hash, nTxConfirmTarget, false, 0, true, FeeEstimateMode::UNSET)); + feeBump.reset(new CFeeBumper(wallet, hash, coin_control, 0)); } if (feeBump->getResult() != BumpFeeResult::OK) { |