Merge pull request #126 from UdjinM6/fix_ds_toggle_unlock

fix unlocking wallet on ds toggle event
This commit is contained in:
Darkcoin 2015-01-21 08:00:40 -07:00
commit 8f88c50035

View File

@ -450,20 +450,19 @@ void OverviewPage::toggleDarksend(){
return;
}
if (pwalletMain->GetBalance() - pwalletMain->GetAnonymizedBalance() > 2*COIN){
if (walletModel->getEncryptionStatus() != WalletModel::Unencrypted){
if((nAnonymizeDarkcoinAmount*COIN)-pwalletMain->GetAnonymizedBalance() > 1.1*COIN &&
walletModel->getEncryptionStatus() == WalletModel::Locked){
// if wallet is locked, ask for a passphrase
if (walletModel->getEncryptionStatus() == WalletModel::Locked)
{
WalletModel::UnlockContext ctx(walletModel->requestUnlock(false));
if(!ctx.isValid()){
if(!ctx.isValid())
{
//unlock was cancelled
fEnableDarksend = false;
darkSendPool.cachedNumBlocks = 0;
LogPrintf("Wallet is locked and user declined to unlock. Disabling Darksend.\n");
}
}
QMessageBox::warning(this, tr("Darksend"),
tr("Wallet is locked and user declined to unlock. Disabling Darksend."),
QMessageBox::Ok, QMessageBox::Ok);
if (fDebug) LogPrintf("Wallet is locked and user declined to unlock. Disabling Darksend.\n");
return;
}
}