Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsdialog.cpp
Show First 20 Lines • Show All 659 Lines • ▼ Show 20 Lines | void SendCoinsDialog::updateFeeSectionControls() { | ||||
ui->customFee->setEnabled(ui->radioCustomFee->isChecked() && | ui->customFee->setEnabled(ui->radioCustomFee->isChecked() && | ||||
!ui->checkBoxMinimumFee->isChecked()); | !ui->checkBoxMinimumFee->isChecked()); | ||||
} | } | ||||
void SendCoinsDialog::updateGlobalFeeVariables() { | void SendCoinsDialog::updateGlobalFeeVariables() { | ||||
if (ui->radioSmartFee->isChecked()) { | if (ui->radioSmartFee->isChecked()) { | ||||
int nConfirmTarget = | int nConfirmTarget = | ||||
ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 2; | ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 2; | ||||
payTxFee = CFeeRate(0); | payTxFee = CFeeRate(Amount(0)); | ||||
// set nMinimumTotalFee to 0 to not accidentally pay a custom fee | // set nMinimumTotalFee to 0 to not accidentally pay a custom fee | ||||
CoinControlDialog::coinControl->nMinimumTotalFee = 0; | CoinControlDialog::coinControl->nMinimumTotalFee = Amount(0); | ||||
// show the estimated required time for confirmation | // show the estimated required time for confirmation | ||||
ui->confirmationTargetLabel->setText( | ui->confirmationTargetLabel->setText( | ||||
GUIUtil::formatDurationStr( | GUIUtil::formatDurationStr( | ||||
nConfirmTarget * Params().GetConsensus().nPowTargetSpacing) + | nConfirmTarget * Params().GetConsensus().nPowTargetSpacing) + | ||||
" / " + tr("%n block(s)", "", nConfirmTarget)); | " / " + tr("%n block(s)", "", nConfirmTarget)); | ||||
} else { | } else { | ||||
payTxFee = CFeeRate(ui->customFee->value()); | payTxFee = CFeeRate(Amount(ui->customFee->value())); | ||||
// if user has selected to set a minimum absolute fee, pass the value to | // if user has selected to set a minimum absolute fee, pass the value to | ||||
// coincontrol | // coincontrol | ||||
// set nMinimumTotalFee to 0 in case of user has selected that the fee | // set nMinimumTotalFee to 0 in case of user has selected that the fee | ||||
// is per KB | // is per KB | ||||
CoinControlDialog::coinControl->nMinimumTotalFee = | CoinControlDialog::coinControl->nMinimumTotalFee = Amount( | ||||
ui->radioCustomAtLeast->isChecked() ? ui->customFee->value() : 0; | ui->radioCustomAtLeast->isChecked() ? ui->customFee->value() : 0); | ||||
} | } | ||||
} | } | ||||
void SendCoinsDialog::updateFeeMinimizedLabel() { | void SendCoinsDialog::updateFeeMinimizedLabel() { | ||||
if (!model || !model->getOptionsModel()) return; | if (!model || !model->getOptionsModel()) return; | ||||
if (ui->radioSmartFee->isChecked()) | if (ui->radioSmartFee->isChecked()) | ||||
ui->labelFeeMinimized->setText(ui->labelSmartFee->text()); | ui->labelFeeMinimized->setText(ui->labelSmartFee->text()); | ||||
Show All 20 Lines | 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(0)) { | if (feeRate <= CFeeRate(Amount(0))) { | ||||
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::GetRequiredFee(1000)) | ||||
.GetSatoshis()) + | .GetSatoshis()) + | ||||
"/kB"); | "/kB"); | ||||
// (Smart fee not initialized yet. This usually takes a few blocks...) | // (Smart fee not initialized yet. This usually takes a few blocks...) | ||||
▲ Show 20 Lines • Show All 240 Lines • Show Last 20 Lines |