|
|
|
@ -110,7 +110,6 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p
@@ -110,7 +110,6 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p
|
|
|
|
|
ui->groupCustomFee->setId(ui->radioCustomPerKilobyte, 0); |
|
|
|
|
ui->groupCustomFee->setId(ui->radioCustomAtLeast, 1); |
|
|
|
|
ui->groupCustomFee->button((int)std::max(0, std::min(1, settings.value("nCustomFeeRadio").toInt())))->setChecked(true); |
|
|
|
|
ui->sliderSmartFee->setValue(settings.value("nSmartFeeSliderPosition").toInt()); |
|
|
|
|
ui->customFee->setValue(settings.value("nTransactionFee").toLongLong()); |
|
|
|
|
ui->checkBoxMinimumFee->setChecked(settings.value("fPayOnlyMinFee").toBool()); |
|
|
|
|
minimizeFeeSection(settings.value("fFeeSectionMinimized").toBool()); |
|
|
|
@ -172,6 +171,13 @@ void SendCoinsDialog::setModel(WalletModel *_model)
@@ -172,6 +171,13 @@ void SendCoinsDialog::setModel(WalletModel *_model)
|
|
|
|
|
updateMinFeeLabel(); |
|
|
|
|
updateSmartFeeLabel(); |
|
|
|
|
updateGlobalFeeVariables(); |
|
|
|
|
|
|
|
|
|
// set the smartfee-sliders default value (wallets default conf.target or last stored value)
|
|
|
|
|
QSettings settings; |
|
|
|
|
if (settings.value("nSmartFeeSliderPosition").toInt() == 0) |
|
|
|
|
ui->sliderSmartFee->setValue(ui->sliderSmartFee->maximum() - model->getDefaultConfirmTarget() + 1); |
|
|
|
|
else |
|
|
|
|
ui->sliderSmartFee->setValue(settings.value("nSmartFeeSliderPosition").toInt()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -229,10 +235,17 @@ void SendCoinsDialog::on_sendButton_clicked()
@@ -229,10 +235,17 @@ void SendCoinsDialog::on_sendButton_clicked()
|
|
|
|
|
// prepare transaction for getting txFee earlier
|
|
|
|
|
WalletModelTransaction currentTransaction(recipients); |
|
|
|
|
WalletModel::SendCoinsReturn prepareStatus; |
|
|
|
|
if (model->getOptionsModel()->getCoinControlFeatures()) // coin control enabled
|
|
|
|
|
prepareStatus = model->prepareTransaction(currentTransaction, CoinControlDialog::coinControl); |
|
|
|
|
|
|
|
|
|
// Always use a CCoinControl instance, use the CoinControlDialog instance if CoinControl has been enabled
|
|
|
|
|
CCoinControl ctrl; |
|
|
|
|
if (model->getOptionsModel()->getCoinControlFeatures()) |
|
|
|
|
ctrl = *CoinControlDialog::coinControl; |
|
|
|
|
if (ui->radioSmartFee->isChecked()) |
|
|
|
|
ctrl.nConfirmTarget = ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 1; |
|
|
|
|
else |
|
|
|
|
prepareStatus = model->prepareTransaction(currentTransaction); |
|
|
|
|
ctrl.nConfirmTarget = 0; |
|
|
|
|
|
|
|
|
|
prepareStatus = model->prepareTransaction(currentTransaction, &ctrl); |
|
|
|
|
|
|
|
|
|
// process prepareStatus and on error generate message shown to user
|
|
|
|
|
processSendCoinsReturn(prepareStatus, |
|
|
|
@ -576,6 +589,7 @@ void SendCoinsDialog::updateFeeSectionControls()
@@ -576,6 +589,7 @@ void SendCoinsDialog::updateFeeSectionControls()
|
|
|
|
|
ui->labelFeeEstimation ->setEnabled(ui->radioSmartFee->isChecked()); |
|
|
|
|
ui->labelSmartFeeNormal ->setEnabled(ui->radioSmartFee->isChecked()); |
|
|
|
|
ui->labelSmartFeeFast ->setEnabled(ui->radioSmartFee->isChecked()); |
|
|
|
|
ui->confirmationTargetLabel ->setEnabled(ui->radioSmartFee->isChecked()); |
|
|
|
|
ui->checkBoxMinimumFee ->setEnabled(ui->radioCustomFee->isChecked()); |
|
|
|
|
ui->labelMinFeeWarning ->setEnabled(ui->radioCustomFee->isChecked()); |
|
|
|
|
ui->radioCustomPerKilobyte ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked()); |
|
|
|
@ -587,15 +601,17 @@ void SendCoinsDialog::updateGlobalFeeVariables()
@@ -587,15 +601,17 @@ void SendCoinsDialog::updateGlobalFeeVariables()
|
|
|
|
|
{ |
|
|
|
|
if (ui->radioSmartFee->isChecked()) |
|
|
|
|
{ |
|
|
|
|
nTxConfirmTarget = defaultConfirmTarget - ui->sliderSmartFee->value(); |
|
|
|
|
int nConfirmTarget = ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 1; |
|
|
|
|
payTxFee = CFeeRate(0); |
|
|
|
|
|
|
|
|
|
// set nMinimumTotalFee to 0 to not accidentally pay a custom fee
|
|
|
|
|
CoinControlDialog::coinControl->nMinimumTotalFee = 0; |
|
|
|
|
|
|
|
|
|
// show the estimated reuquired time for confirmation
|
|
|
|
|
ui->confirmationTargetLabel->setText(GUIUtil::formatDurationStr(nConfirmTarget*600)+" / "+tr("%n block(s)", "", nConfirmTarget)); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
nTxConfirmTarget = defaultConfirmTarget; |
|
|
|
|
payTxFee = CFeeRate(ui->customFee->value()); |
|
|
|
|
|
|
|
|
|
// if user has selected to set a minimum absolute fee, pass the value to coincontrol
|
|
|
|
@ -630,7 +646,7 @@ void SendCoinsDialog::updateSmartFeeLabel()
@@ -630,7 +646,7 @@ void SendCoinsDialog::updateSmartFeeLabel()
|
|
|
|
|
if(!model || !model->getOptionsModel()) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
int nBlocksToConfirm = defaultConfirmTarget - ui->sliderSmartFee->value(); |
|
|
|
|
int nBlocksToConfirm = ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 1; |
|
|
|
|
int estimateFoundAtBlocks = nBlocksToConfirm; |
|
|
|
|
CFeeRate feeRate = mempool.estimateSmartFee(nBlocksToConfirm, &estimateFoundAtBlocks); |
|
|
|
|
if (feeRate <= CFeeRate(0)) // not enough data => minfee
|
|
|
|
@ -701,6 +717,8 @@ void SendCoinsDialog::coinControlFeatureChanged(bool checked)
@@ -701,6 +717,8 @@ void SendCoinsDialog::coinControlFeatureChanged(bool checked)
|
|
|
|
|
if (!checked && model) // coin control features disabled
|
|
|
|
|
CoinControlDialog::coinControl->SetNull(); |
|
|
|
|
|
|
|
|
|
// make sure we set back the confirmation target
|
|
|
|
|
updateGlobalFeeVariables(); |
|
|
|
|
coinControlUpdateLabels(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|