Skip to content

Commit

Permalink
Merge pull request #69 from UdjinM6/fix_send_locking
Browse files Browse the repository at this point in the history
Fix send locking
  • Loading branch information
darkcoinproject committed Dec 12, 2014
2 parents f2cf90d + cc28fef commit e3c0d69
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
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

0 comments on commit e3c0d69

Please sign in to comment.