Skip to content

Commit

Permalink
Merge bitcoin-core/gui#284: refactor: Simplify SendCoinsDialog::updat…
Browse files Browse the repository at this point in the history
…eCoinControlState

5f438d6 refactor, qt: Simplify SendCoinsDialog::updateCoinControlState (João Barbosa)

Pull request description:

  This PR doesn't change behaviour, removes the coin control argument from `updateCoinControlState` since it's a class member.

ACKs for top commit:
  hebasto:
    ACK 5f438d6, I have reviewed the code and it looks OK, I agree it can be merged.
  jonatack:
    Code review ACK 5f438d6
  kristapsk:
    utACK 5f438d6. Code looks correct.

Tree-SHA512: 14abaa3d561f8c8854fed989b6aca886dcca42135880bac76070043f61c0042ec8967f2b83e50bbbb82050ef0f074209e97fa300cb4dc51ee182316e0846506d
  • Loading branch information
hebasto authored and knst committed Apr 23, 2024
1 parent b2d8893 commit a63f9c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/qt/sendcoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ bool SendCoinsDialog::send(const QList<SendCoinsRecipient>& recipients, QString&
m_current_transaction = std::make_unique<WalletModelTransaction>(recipients);
WalletModel::SendCoinsReturn prepareStatus;

updateCoinControlState(*m_coin_control);
updateCoinControlState();

prepareStatus = model->prepareTransaction(*m_current_transaction, *m_coin_control);

Expand Down Expand Up @@ -829,18 +829,18 @@ void SendCoinsDialog::updateFeeMinimizedLabel()
}
}

void SendCoinsDialog::updateCoinControlState(CCoinControl& ctrl)
void SendCoinsDialog::updateCoinControlState()
{
if (ui->radioCustomFee->isChecked()) {
ctrl.m_feerate = CFeeRate(ui->customFee->value());
m_coin_control->m_feerate = CFeeRate(ui->customFee->value());
} else {
ctrl.m_feerate.reset();
m_coin_control->m_feerate.reset();
}
// Avoid using global defaults when sending money from the GUI
// Either custom fee will be used or if not selected, the confirmation target from dropdown box
ctrl.m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex());
m_coin_control->m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex());
// Include watch-only for wallets without private key
ctrl.fAllowWatchOnly = model->wallet().privateKeysDisabled();
m_coin_control->fAllowWatchOnly = model->wallet().privateKeysDisabled();
}

void SendCoinsDialog::updateNumberOfBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool header, SynchronizationState sync_state) {
Expand All @@ -853,7 +853,7 @@ void SendCoinsDialog::updateSmartFeeLabel()
{
if(!model || !model->getOptionsModel())
return;
updateCoinControlState(*m_coin_control);
updateCoinControlState();
m_coin_control->m_feerate.reset(); // Explicitly use only fee estimation rate for smart fee labels
int returned_target;
FeeReason reason;
Expand Down Expand Up @@ -1013,7 +1013,7 @@ void SendCoinsDialog::coinControlUpdateLabels()
if (!model || !model->getOptionsModel())
return;

updateCoinControlState(*m_coin_control);
updateCoinControlState();

// set pay amounts
CoinControlDialog::payAmounts.clear();
Expand Down
3 changes: 1 addition & 2 deletions src/qt/sendcoinsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ public Q_SLOTS:
// Format confirmation message
bool PrepareSendText(QString& question_string, QString& informative_text, QString& detailed_text);
void updateFeeMinimizedLabel();
// Update the passed in CCoinControl with state from the GUI
void updateCoinControlState(CCoinControl& ctrl);
void updateCoinControlState();

private Q_SLOTS:
void sendButtonClicked(bool checked);
Expand Down

0 comments on commit a63f9c3

Please sign in to comment.