-
Notifications
You must be signed in to change notification settings - Fork 314
Add Create Unsigned button to SendConfirmationDialog #441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -114,18 +114,21 @@ class SendConfirmationDialog : public QMessageBox | |||||||||||||
Q_OBJECT | ||||||||||||||
|
||||||||||||||
public: | ||||||||||||||
SendConfirmationDialog(const QString& title, const QString& text, const QString& informative_text = "", const QString& detailed_text = "", int secDelay = SEND_CONFIRM_DELAY, const QString& confirmText = "", QWidget* parent = nullptr); | ||||||||||||||
SendConfirmationDialog(const QString& title, const QString& text, const QString& informative_text = "", const QString& detailed_text = "", int secDelay = SEND_CONFIRM_DELAY, bool enable_send = true, bool always_show_unsigned = true, QWidget* parent = nullptr); | ||||||||||||||
int exec() override; | ||||||||||||||
|
||||||||||||||
private Q_SLOTS: | ||||||||||||||
void countDown(); | ||||||||||||||
void updateYesButton(); | ||||||||||||||
void updateButtons(); | ||||||||||||||
|
||||||||||||||
private: | ||||||||||||||
QAbstractButton *yesButton; | ||||||||||||||
QAbstractButton *m_psbt_button; | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style nit:
Suggested change
|
||||||||||||||
QTimer countDownTimer; | ||||||||||||||
int secDelay; | ||||||||||||||
QString confirmButtonText; | ||||||||||||||
QString confirmButtonText{tr("Send")}; | ||||||||||||||
bool m_enable_send; | ||||||||||||||
QString m_psbt_button_text{tr("Create Unsigned")}; | ||||||||||||||
Comment on lines
+129
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
|
||||||||||||||
}; | ||||||||||||||
|
||||||||||||||
#endif // BITCOIN_QT_SENDCOINSDIALOG_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -480,10 +480,9 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash) | |
return false; | ||
} | ||
|
||
const bool create_psbt = m_wallet->privateKeysDisabled(); | ||
|
||
// allow a user based fee verification | ||
QString questionString = create_psbt ? tr("Do you want to draft a transaction with fee increase?") : tr("Do you want to increase the fee?"); | ||
/*: Asks a user if they would like to manually increase the fee of a transaction that has already been created. */ | ||
QString questionString = tr("Do you want to increase the fee?"); | ||
questionString.append("<br />"); | ||
questionString.append("<table style=\"text-align: left;\">"); | ||
questionString.append("<tr><td>"); | ||
|
@@ -506,13 +505,13 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash) | |
questionString.append(tr("Warning: This may pay the additional fee by reducing change outputs or adding inputs, when necessary. It may add a new change output if one does not already exist. These changes may potentially leak privacy.")); | ||
} | ||
|
||
auto confirmationDialog = new SendConfirmationDialog(tr("Confirm fee bump"), questionString); | ||
auto confirmationDialog = new SendConfirmationDialog(tr("Confirm fee bump"), questionString, "", "", SEND_CONFIRM_DELAY, !m_wallet->privateKeysDisabled(), getOptionsModel()->getEnablePSBTControls(), nullptr); | ||
confirmationDialog->setAttribute(Qt::WA_DeleteOnClose); | ||
// TODO: Replace QDialog::exec() with safer QDialog::show(). | ||
const auto retval = static_cast<QMessageBox::StandardButton>(confirmationDialog->exec()); | ||
|
||
// cancel sign&broadcast if user doesn't want to bump the fee | ||
if (retval != QMessageBox::Yes) { | ||
if (retval != QMessageBox::Yes && retval != QMessageBox::Save) { | ||
return false; | ||
} | ||
|
||
|
@@ -523,7 +522,7 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash) | |
} | ||
|
||
// Short-circuit if we are returning a bumped transaction PSBT to clipboard | ||
if (create_psbt) { | ||
if (retval == QMessageBox::Save) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As Is |
||
PartiallySignedTransaction psbtx(mtx); | ||
bool complete = false; | ||
const TransactionError err = wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, nullptr, psbtx, complete); | ||
|
@@ -539,6 +538,8 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash) | |
return true; | ||
} | ||
|
||
assert(!m_wallet->privateKeysDisabled()); | ||
|
||
// sign bumped transaction | ||
if (!m_wallet->signBumpTransaction(mtx)) { | ||
QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Can't sign transaction.")); | ||
|
Uh oh!
There was an error while loading. Please reload this page.