|
10 | 10 |
|
11 | 11 | #include <qt/addresstablemodel.h>
|
12 | 12 | #include <qt/guiconstants.h>
|
| 13 | +#include <qt/guiutil.h> |
13 | 14 | #include <qt/optionsmodel.h>
|
14 | 15 | #include <qt/paymentserver.h>
|
15 | 16 | #include <qt/recentrequeststablemodel.h>
|
@@ -487,8 +488,10 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
|
487 | 488 | return false;
|
488 | 489 | }
|
489 | 490 |
|
| 491 | + const bool create_psbt = privateKeysDisabled(); |
| 492 | + |
490 | 493 | // allow a user based fee verification
|
491 |
| - QString questionString = tr("Do you want to increase the fee?"); |
| 494 | + QString questionString = create_psbt ? tr("Do you want to draft a transaction with fee increase?") : tr("Do you want to increase the fee?"); |
492 | 495 | questionString.append("<br />");
|
493 | 496 | questionString.append("<table style=\"text-align: left;\">");
|
494 | 497 | questionString.append("<tr><td>");
|
@@ -519,6 +522,21 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
|
519 | 522 | return false;
|
520 | 523 | }
|
521 | 524 |
|
| 525 | + // Short-circuit if we are returning a bumped transaction PSBT to clipboard |
| 526 | + if (create_psbt) { |
| 527 | + PartiallySignedTransaction psbtx(mtx); |
| 528 | + bool complete = false; |
| 529 | + const TransactionError err = wallet().fillPSBT(psbtx, complete, SIGHASH_ALL, false /* sign */, true /* bip32derivs */); |
| 530 | + assert(!complete); |
| 531 | + assert(err == TransactionError::OK); |
| 532 | + // Serialize the PSBT |
| 533 | + CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); |
| 534 | + ssTx << psbtx; |
| 535 | + GUIUtil::setClipboard(EncodeBase64(ssTx.str()).c_str()); |
| 536 | + Q_EMIT message(tr("PSBT copied"), "Copied to clipboard", CClientUIInterface::MSG_INFORMATION); |
| 537 | + return true; |
| 538 | + } |
| 539 | + |
522 | 540 | // sign bumped transaction
|
523 | 541 | if (!m_wallet->signBumpTransaction(mtx)) {
|
524 | 542 | QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Can't sign transaction."));
|
|
0 commit comments