Skip to content

Commit

Permalink
GUI: Ask user to unlock wallet before signing psbt
Browse files Browse the repository at this point in the history
  • Loading branch information
meshcollider committed Sep 28, 2021
1 parent 0f3acec commit 7e3ee4c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/qt/psbtoperationsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ void PSBTOperationsDialog::signTransaction()
{
bool complete;
size_t n_signed;

WalletModel::UnlockContext ctx(m_wallet_model->requestUnlock());

TransactionError err = m_wallet_model->wallet().fillPSBT(SIGHASH_ALL, true /* sign */, true /* bip32derivs */, &n_signed, m_transaction_data, complete);

if (err != TransactionError::OK) {
Expand All @@ -81,7 +84,9 @@ void PSBTOperationsDialog::signTransaction()

updateTransactionDisplay();

if (!complete && n_signed < 1) {
if (!complete && !ctx.isValid()) {
showStatus(tr("Cannot sign inputs while wallet is locked."), StatusLevel::WARN);
} else if (!complete && n_signed < 1) {
showStatus(tr("Could not sign any more inputs."), StatusLevel::WARN);
} else if (!complete) {
showStatus(tr("Signed %1 inputs, but more signatures are still required.").arg(n_signed),
Expand Down

0 comments on commit 7e3ee4c

Please sign in to comment.