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