Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsdialog.cpp
Show First 20 Lines • Show All 213 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( | ui->customFee->setSingleStep(CWallet::GetRequiredFee(1000)); | ||||
CWallet::GetRequiredFee(1000).GetSatoshis()); | |||||
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 362 Lines • ▼ Show 20 Lines | switch (sendCoinsReturn.status) { | ||||
tr("The transaction was rejected with the following reason: %1") | tr("The transaction was rejected with the following reason: %1") | ||||
.arg(sendCoinsReturn.reasonCommitFailed); | .arg(sendCoinsReturn.reasonCommitFailed); | ||||
msgParams.second = CClientUIInterface::MSG_ERROR; | msgParams.second = CClientUIInterface::MSG_ERROR; | ||||
break; | break; | ||||
case WalletModel::AbsurdFee: | case WalletModel::AbsurdFee: | ||||
msgParams.first = | msgParams.first = | ||||
tr("A fee higher than %1 is considered an absurdly high fee.") | tr("A fee higher than %1 is considered an absurdly high fee.") | ||||
.arg(BitcoinUnits::formatWithUnit( | .arg(BitcoinUnits::formatWithUnit( | ||||
model->getOptionsModel()->getDisplayUnit(), | model->getOptionsModel()->getDisplayUnit(), maxTxFee)); | ||||
maxTxFee.GetSatoshis())); | |||||
break; | break; | ||||
case WalletModel::PaymentRequestExpired: | case WalletModel::PaymentRequestExpired: | ||||
msgParams.first = tr("Payment request expired."); | msgParams.first = tr("Payment request expired."); | ||||
msgParams.second = CClientUIInterface::MSG_ERROR; | msgParams.second = CClientUIInterface::MSG_ERROR; | ||||
break; | break; | ||||
// included to prevent a compiler warning. | // included to prevent a compiler warning. | ||||
case WalletModel::OK: | case WalletModel::OK: | ||||
default: | default: | ||||
Show All 19 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).GetSatoshis()); | ui->customFee->setValue(CWallet::GetRequiredFee(1000)); | ||||
} | } | ||||
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 54 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).GetSatoshis()) + | CWallet::GetRequiredFee(1000)) + | ||||
"/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(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()) + | |||||
"/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::GetRequiredFee(1000))) + | ||||
.GetSatoshis()) + | |||||
"/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 224 Lines • Show Last 20 Lines |