Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsdialog.cpp
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | if (_model && _model->getOptionsModel()) { | ||||
SLOT(coinControlUpdateLabels())); | SLOT(coinControlUpdateLabels())); | ||||
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | ||||
SLOT(setMinimumFee())); | SLOT(setMinimumFee())); | ||||
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | ||||
SLOT(updateFeeSectionControls())); | SLOT(updateFeeSectionControls())); | ||||
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | ||||
SLOT(coinControlUpdateLabels())); | SLOT(coinControlUpdateLabels())); | ||||
ui->customFee->setSingleStep(model->node().getMinimumFee(1000)); | ui->customFee->setSingleStep(GetRequiredFee(1000)); | ||||
updateFeeSectionControls(); | updateFeeSectionControls(); | ||||
updateMinFeeLabel(); | updateMinFeeLabel(); | ||||
updateSmartFeeLabel(); | updateSmartFeeLabel(); | ||||
// Cleanup old confirmation target related settings | // Cleanup old confirmation target related settings | ||||
// TODO: Remove these in 0.20 | // TODO: Remove these in 0.20 | ||||
QSettings settings; | QSettings settings; | ||||
if (settings.value("nSmartFeeSliderPosition").toInt() != 0) { | if (settings.value("nSmartFeeSliderPosition").toInt() != 0) { | ||||
▲ Show 20 Lines • Show All 429 Lines • ▼ Show 20 Lines | if (amount > Amount::zero()) { | ||||
entry->setAmount(amount); | entry->setAmount(amount); | ||||
} else { | } else { | ||||
entry->setAmount(Amount::zero()); | entry->setAmount(Amount::zero()); | ||||
} | } | ||||
} | } | ||||
void SendCoinsDialog::setMinimumFee() { | void SendCoinsDialog::setMinimumFee() { | ||||
ui->radioCustomPerKilobyte->setChecked(true); | ui->radioCustomPerKilobyte->setChecked(true); | ||||
ui->customFee->setValue(model->node().getMinimumFee(1000)); | ui->customFee->setValue(GetRequiredFee(1000)); | ||||
} | } | ||||
void SendCoinsDialog::updateFeeSectionControls() { | void SendCoinsDialog::updateFeeSectionControls() { | ||||
ui->labelSmartFee->setEnabled(ui->radioSmartFee->isChecked()); | ui->labelSmartFee->setEnabled(ui->radioSmartFee->isChecked()); | ||||
ui->labelSmartFee2->setEnabled(ui->radioSmartFee->isChecked()); | ui->labelSmartFee2->setEnabled(ui->radioSmartFee->isChecked()); | ||||
ui->labelFeeEstimation->setEnabled(ui->radioSmartFee->isChecked()); | ui->labelFeeEstimation->setEnabled(ui->radioSmartFee->isChecked()); | ||||
ui->checkBoxMinimumFee->setEnabled(ui->radioCustomFee->isChecked()); | ui->checkBoxMinimumFee->setEnabled(ui->radioCustomFee->isChecked()); | ||||
ui->labelMinFeeWarning->setEnabled(ui->radioCustomFee->isChecked()); | ui->labelMinFeeWarning->setEnabled(ui->radioCustomFee->isChecked()); | ||||
Show All 21 Lines | |||||
} | } | ||||
void SendCoinsDialog::updateMinFeeLabel() { | void SendCoinsDialog::updateMinFeeLabel() { | ||||
if (model && model->getOptionsModel()) { | if (model && model->getOptionsModel()) { | ||||
ui->checkBoxMinimumFee->setText( | ui->checkBoxMinimumFee->setText( | ||||
tr("Pay only the required fee of %1") | tr("Pay only the required fee of %1") | ||||
.arg(BitcoinUnits::formatWithUnit( | .arg(BitcoinUnits::formatWithUnit( | ||||
model->getOptionsModel()->getDisplayUnit(), | model->getOptionsModel()->getDisplayUnit(), | ||||
model->node().getMinimumFee(1000)) + | GetRequiredFee(1000)) + | ||||
"/kB")); | "/kB")); | ||||
} | } | ||||
} | } | ||||
void SendCoinsDialog::updateCoinControlState(CCoinControl &ctrl) { | void SendCoinsDialog::updateCoinControlState(CCoinControl &ctrl) { | ||||
if (ui->radioCustomFee->isChecked()) { | if (ui->radioCustomFee->isChecked()) { | ||||
ctrl.m_feerate = CFeeRate(ui->customFee->value()); | ctrl.m_feerate = CFeeRate(ui->customFee->value()); | ||||
} else { | } else { | ||||
ctrl.m_feerate.reset(); | ctrl.m_feerate.reset(); | ||||
} | } | ||||
} | } | ||||
void SendCoinsDialog::updateSmartFeeLabel() { | void SendCoinsDialog::updateSmartFeeLabel() { | ||||
if (!model || !model->getOptionsModel()) { | if (!model || !model->getOptionsModel()) { | ||||
return; | return; | ||||
} | } | ||||
CFeeRate feeRate = model->node().estimateSmartFee(); | CCoinControl coin_control; | ||||
updateCoinControlState(coin_control); | |||||
// Explicitly use only fee estimation rate for smart fee labels | |||||
coin_control.m_feerate.reset(); | |||||
CFeeRate feeRate(model->node().getMinimumFee(1000, coin_control)); | |||||
ui->labelSmartFee->setText( | ui->labelSmartFee->setText( | ||||
BitcoinUnits::formatWithUnit( | BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), | ||||
model->getOptionsModel()->getDisplayUnit(), | feeRate.GetFeePerK()) + | ||||
std::max(feeRate.GetFeePerK(), model->node().getMinimumFee(1000))) + | |||||
"/kB"); | "/kB"); | ||||
// not enough data => minfee | // not enough data => minfee | ||||
if (feeRate <= CFeeRate(Amount::zero())) { | if (feeRate <= CFeeRate(Amount::zero())) { | ||||
// (Smart fee not initialized yet. This usually takes a few blocks...) | // (Smart fee not initialized yet. This usually takes a few blocks...) | ||||
ui->labelSmartFee2->show(); | ui->labelSmartFee2->show(); | ||||
ui->labelFeeEstimation->setText(""); | ui->labelFeeEstimation->setText(""); | ||||
} else { | } else { | ||||
ui->labelSmartFee2->hide(); | ui->labelSmartFee2->hide(); | ||||
▲ Show 20 Lines • Show All 220 Lines • Show Last 20 Lines |