mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 23:07:59 +01:00
QT: bump fee returns PSBT on clipboard for watchonly-only wallets
This commit is contained in:
parent
45f151913e
commit
e3b19d8696
1 changed files with 19 additions and 1 deletions
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include <qt/addresstablemodel.h>
|
#include <qt/addresstablemodel.h>
|
||||||
#include <qt/guiconstants.h>
|
#include <qt/guiconstants.h>
|
||||||
|
#include <qt/guiutil.h>
|
||||||
#include <qt/optionsmodel.h>
|
#include <qt/optionsmodel.h>
|
||||||
#include <qt/paymentserver.h>
|
#include <qt/paymentserver.h>
|
||||||
#include <qt/recentrequeststablemodel.h>
|
#include <qt/recentrequeststablemodel.h>
|
||||||
|
@ -487,8 +488,10 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool create_psbt = privateKeysDisabled();
|
||||||
|
|
||||||
// allow a user based fee verification
|
// allow a user based fee verification
|
||||||
QString questionString = tr("Do you want to increase the fee?");
|
QString questionString = create_psbt ? tr("Do you want to draft a transaction with fee increase?") : tr("Do you want to increase the fee?");
|
||||||
questionString.append("<br />");
|
questionString.append("<br />");
|
||||||
questionString.append("<table style=\"text-align: left;\">");
|
questionString.append("<table style=\"text-align: left;\">");
|
||||||
questionString.append("<tr><td>");
|
questionString.append("<tr><td>");
|
||||||
|
@ -519,6 +522,21 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Short-circuit if we are returning a bumped transaction PSBT to clipboard
|
||||||
|
if (create_psbt) {
|
||||||
|
PartiallySignedTransaction psbtx(mtx);
|
||||||
|
bool complete = false;
|
||||||
|
const TransactionError err = wallet().fillPSBT(psbtx, complete, SIGHASH_ALL, false /* sign */, true /* bip32derivs */);
|
||||||
|
assert(!complete);
|
||||||
|
assert(err == TransactionError::OK);
|
||||||
|
// Serialize the PSBT
|
||||||
|
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
|
||||||
|
ssTx << psbtx;
|
||||||
|
GUIUtil::setClipboard(EncodeBase64(ssTx.str()).c_str());
|
||||||
|
Q_EMIT message(tr("PSBT copied"), "Copied to clipboard", CClientUIInterface::MSG_INFORMATION);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// sign bumped transaction
|
// sign bumped transaction
|
||||||
if (!m_wallet->signBumpTransaction(mtx)) {
|
if (!m_wallet->signBumpTransaction(mtx)) {
|
||||||
QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Can't sign transaction."));
|
QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Can't sign transaction."));
|
||||||
|
|
Loading…
Add table
Reference in a new issue