Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsdialog.cpp
Show First 20 Lines • Show All 214 Lines • ▼ Show 20 Lines | if (_model && _model->getOptionsModel()) { | ||||
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(updateGlobalFeeVariables())); | SLOT(updateGlobalFeeVariables())); | ||||
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | ||||
SLOT(coinControlUpdateLabels())); | SLOT(coinControlUpdateLabels())); | ||||
ui->customFee->setSingleStep(CWallet::GetRequiredFee(1000)); | ui->customFee->setSingleStep(CWallet::GetMinimumFee(1000, 2, mempool)); | ||||
updateFeeSectionControls(); | updateFeeSectionControls(); | ||||
updateMinFeeLabel(); | updateMinFeeLabel(); | ||||
updateSmartFeeLabel(); | updateSmartFeeLabel(); | ||||
updateGlobalFeeVariables(); | updateGlobalFeeVariables(); | ||||
// set the smartfee-sliders default value (wallets default conf.target | // set the smartfee-sliders default value (wallets default conf.target | ||||
// or last stored value) | // or last stored value) | ||||
QSettings settings; | QSettings settings; | ||||
▲ Show 20 Lines • Show All 399 Lines • ▼ Show 20 Lines | |||||
void SendCoinsDialog::on_buttonMinimizeFee_clicked() { | void SendCoinsDialog::on_buttonMinimizeFee_clicked() { | ||||
updateFeeMinimizedLabel(); | updateFeeMinimizedLabel(); | ||||
minimizeFeeSection(true); | minimizeFeeSection(true); | ||||
} | } | ||||
void SendCoinsDialog::setMinimumFee() { | void SendCoinsDialog::setMinimumFee() { | ||||
ui->radioCustomPerKilobyte->setChecked(true); | ui->radioCustomPerKilobyte->setChecked(true); | ||||
ui->customFee->setValue(CWallet::GetRequiredFee(1000)); | ui->customFee->setValue(CWallet::GetMinimumFee(1000, 2, mempool)); | ||||
} | } | ||||
void SendCoinsDialog::updateFeeSectionControls() { | void SendCoinsDialog::updateFeeSectionControls() { | ||||
ui->sliderSmartFee->setEnabled(ui->radioSmartFee->isChecked()); | ui->sliderSmartFee->setEnabled(ui->radioSmartFee->isChecked()); | ||||
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->labelSmartFee3->setEnabled(ui->radioSmartFee->isChecked()); | ui->labelSmartFee3->setEnabled(ui->radioSmartFee->isChecked()); | ||||
ui->labelFeeEstimation->setEnabled(ui->radioSmartFee->isChecked()); | ui->labelFeeEstimation->setEnabled(ui->radioSmartFee->isChecked()); | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 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(), | ||||
CWallet::GetRequiredFee(1000)) + | CWallet::GetMinimumFee(1000, 2, mempool)) + | ||||
"/kB")); | "/kB")); | ||||
} | } | ||||
void SendCoinsDialog::updateSmartFeeLabel() { | void SendCoinsDialog::updateSmartFeeLabel() { | ||||
if (!model || !model->getOptionsModel()) return; | if (!model || !model->getOptionsModel()) return; | ||||
int nBlocksToConfirm = | int nBlocksToConfirm = | ||||
ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 2; | ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 2; | ||||
int estimateFoundAtBlocks = nBlocksToConfirm; | int estimateFoundAtBlocks = nBlocksToConfirm; | ||||
CFeeRate feeRate = | CFeeRate feeRate = | ||||
mempool.estimateSmartFee(nBlocksToConfirm, &estimateFoundAtBlocks); | mempool.estimateSmartFee(nBlocksToConfirm, &estimateFoundAtBlocks); | ||||
// not enough data => minfee | // not enough data => minfee | ||||
if (feeRate <= CFeeRate(Amount::zero())) { | if (feeRate <= CFeeRate(Amount::zero())) { | ||||
ui->labelSmartFee->setText( | ui->labelSmartFee->setText( | ||||
BitcoinUnits::formatWithUnit( | BitcoinUnits::formatWithUnit( | ||||
model->getOptionsModel()->getDisplayUnit(), | model->getOptionsModel()->getDisplayUnit(), | ||||
std::max(CWallet::fallbackFee.GetFeePerK(), | std::max(CWallet::fallbackFee.GetFeePerK(), | ||||
CWallet::GetRequiredFee(1000))) + | CWallet::GetMinimumFee(1000, 2, mempool))) + | ||||
"/kB"); | "/kB"); | ||||
// (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->labelSmartFee->setText( | ui->labelSmartFee->setText( | ||||
BitcoinUnits::formatWithUnit( | BitcoinUnits::formatWithUnit( | ||||
model->getOptionsModel()->getDisplayUnit(), | model->getOptionsModel()->getDisplayUnit(), | ||||
std::max(feeRate.GetFeePerK(), CWallet::GetRequiredFee(1000))) + | std::max(feeRate.GetFeePerK(), | ||||
CWallet::GetMinimumFee(1000, 2, mempool))) + | |||||
"/kB"); | "/kB"); | ||||
ui->labelSmartFee2->hide(); | ui->labelSmartFee2->hide(); | ||||
ui->labelFeeEstimation->setText( | ui->labelFeeEstimation->setText( | ||||
tr("Estimated to begin confirmation within %n block(s).", "", | tr("Estimated to begin confirmation within %n block(s).", "", | ||||
estimateFoundAtBlocks)); | estimateFoundAtBlocks)); | ||||
} | } | ||||
updateFeeMinimizedLabel(); | updateFeeMinimizedLabel(); | ||||
▲ Show 20 Lines • Show All 225 Lines • Show Last 20 Lines |