Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix send locking #69

Merged
merged 10 commits into from
Dec 12, 2014
24 changes: 20 additions & 4 deletions src/qt/sendcoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,30 @@ void SendCoinsDialog::on_sendButton_clicked()
return;
}

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);
return;
}
// already unlocked or not encrypted at all
send(recipients);
}

void SendCoinsDialog::send(QList<SendCoinsRecipient> recipients)
{
WalletModel::SendCoinsReturn sendstatus;
if (!model->getOptionsModel() || !model->getOptionsModel()->getCoinControlFeatures())
sendstatus = model->sendCoins(recipients);
Expand Down
1 change: 1 addition & 0 deletions src/qt/sendcoinsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public slots:
bool fNewRecipientAllowed;
bool boolCheckedBalance;
int cachedNumBlocks;
void send(QList<SendCoinsRecipient> recipients);

private slots:
void on_sendButton_clicked();
Expand Down