mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Merge bitcoin-core/gui#441: Add Create Unsigned button to SendConfirmationDialog
742918c8efqt: hide Create Unsigned button behind an expert mode option (Andrew Chow)5c3b800acdqt: Add Create Unsigned button to SendConfirmationDialog (Andrew Chow) Pull request description: Instead of having different buttons or changing button behavior for making a PSBT, just have SendConfirmationDialog return whether the user wants a PSBT or a broadcasted transaction. Since this dialog is used by both the bumpFeeAction and the SendCoinsDialog, changes to both to support the different behavior is needed. They will check the return value of the SendConfirmationDialog for whether a PSBT needs to be created instead of checking whether private keys are disabled. Strings used in this dialog are being slightly modified to work with both private keys enabled and disabled wallets. Moved from https://github.com/bitcoin/bitcoin/pull/18789 ACKs for top commit: jarolrod: ACK742918cryanofsky: Code review ACK742918c8ef. Just suggested changes since last review. Looks great! hebasto: ACK742918c8ef, tested on Linux Mint 20.2 (Qt 5.12.8). Tree-SHA512: dd29f4364c7b4f15befe8fe63257b26187918786b005e0f8336183270b1a162680b93f6ced60f0285c6e607c084cc0d24950fc68a8f9c056521ede614041be66
This commit is contained in:
@@ -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) {
|
||||
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."));
|
||||
|
||||
Reference in New Issue
Block a user