From 9db0eaa9b3984c1492b2c240cc0bea44e4500c3b Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 12 Dec 2014 21:10:38 +0300 Subject: [PATCH] fix wallet locking after sending coins --- src/qt/sendcoinsdialog.cpp | 24 +++++++++++++++++++----- src/qt/sendcoinsdialog.h | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 09bfafe93e586..ecb2dec81c375 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -202,15 +202,29 @@ void SendCoinsDialog::on_sendButton_clicked() fNewRecipientAllowed = false; - - WalletModel::UnlockContext ctx(model->requestUnlock(true)); - if(!ctx.isValid()) + // request unlock only if was locked or unlocked for mixing: + // this way we let users unlock by walletpassphrase or by menu + // and make many transactions while unlocking through this dialog + // will call relock + WalletModel::EncryptionStatus encStatus = model->getEncryptionStatus(); + if(encStatus == model->Locked || encStatus == model->UnlockedForAnonymizationOnly) { - // Unlock wallet was cancelled - fNewRecipientAllowed = true; + WalletModel::UnlockContext ctx(model->requestUnlock(true)); + if(!ctx.isValid()) + { + // Unlock wallet was cancelled + fNewRecipientAllowed = true; + return; + } + send(recipients, strFee, formatted); return; } + // already unlocked or not encrypted at all + send(recipients, strFee, formatted); +} +void SendCoinsDialog::send(QList recipients, QString strFee, QStringList formatted) +{ // prepare transaction for getting txFee earlier WalletModelTransaction currentTransaction(recipients); WalletModel::SendCoinsReturn prepareStatus; diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h index 486f25592d3b1..5df779567625e 100644 --- a/src/qt/sendcoinsdialog.h +++ b/src/qt/sendcoinsdialog.h @@ -53,6 +53,7 @@ public slots: Ui::SendCoinsDialog *ui; WalletModel *model; bool fNewRecipientAllowed; + void send(QList recipients, QString strFee, QStringList formatted); // Process WalletModel::SendCoinsReturn and generate a pair consisting // of a message and message flags for use in emit message().