Skip to content

Commit e3c0d69

Browse files
Merge pull request #69 from UdjinM6/fix_send_locking
Fix send locking
2 parents f2cf90d + cc28fef commit e3c0d69

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/qt/sendcoinsdialog.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,30 @@ void SendCoinsDialog::on_sendButton_clicked()
187187
return;
188188
}
189189

190-
WalletModel::UnlockContext ctx(model->requestUnlock(true));
191-
if(!ctx.isValid())
190+
// request unlock only if was locked or unlocked for mixing:
191+
// this way we let users unlock by walletpassphrase or by menu
192+
// and make many transactions while unlocking through this dialog
193+
// will call relock
194+
WalletModel::EncryptionStatus encStatus = model->getEncryptionStatus();
195+
if(encStatus == model->Locked ||
196+
encStatus == model->UnlockedForAnonymizationOnly)
192197
{
193-
// Unlock wallet was cancelled
194-
fNewRecipientAllowed = true;
198+
WalletModel::UnlockContext ctx(model->requestUnlock(true));
199+
if(!ctx.isValid())
200+
{
201+
// Unlock wallet was cancelled
202+
fNewRecipientAllowed = true;
203+
return;
204+
}
205+
send(recipients);
195206
return;
196207
}
208+
// already unlocked or not encrypted at all
209+
send(recipients);
210+
}
197211

212+
void SendCoinsDialog::send(QList<SendCoinsRecipient> recipients)
213+
{
198214
WalletModel::SendCoinsReturn sendstatus;
199215
if (!model->getOptionsModel() || !model->getOptionsModel()->getCoinControlFeatures())
200216
sendstatus = model->sendCoins(recipients);

src/qt/sendcoinsdialog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public slots:
5050
bool fNewRecipientAllowed;
5151
bool boolCheckedBalance;
5252
int cachedNumBlocks;
53+
void send(QList<SendCoinsRecipient> recipients);
5354

5455
private slots:
5556
void on_sendButton_clicked();

0 commit comments

Comments
 (0)