Skip to content

Commit

Permalink
Merge pull request #72 from UdjinM6/110x_fix_sending_locking
Browse files Browse the repository at this point in the history
fix wallet locking after sending coins
  • Loading branch information
evan82 committed Dec 14, 2014
2 parents 3a8545f + 9db0eaa commit 3a7f3f8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/qt/sendcoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,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<SendCoinsRecipient> recipients, QString strFee, QStringList formatted)
{
// prepare transaction for getting txFee earlier
WalletModelTransaction currentTransaction(recipients);
WalletModel::SendCoinsReturn prepareStatus;
Expand Down
1 change: 1 addition & 0 deletions src/qt/sendcoinsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public slots:
Ui::SendCoinsDialog *ui;
WalletModel *model;
bool fNewRecipientAllowed;
void send(QList<SendCoinsRecipient> recipients, QString strFee, QStringList formatted);

// Process WalletModel::SendCoinsReturn and generate a pair consisting
// of a message and message flags for use in emit message().
Expand Down

0 comments on commit 3a7f3f8

Please sign in to comment.