From 04c38fff9a1e387de856ad0102980f3cf8813d4e Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Mon, 11 Aug 2014 19:54:36 -0700 Subject: [PATCH] fixed locking bug --- src/qt/sendcoinsdialog.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index f2c7d665e8..03abc9e840 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -272,20 +272,22 @@ void SendCoinsDialog::darkSendStatus() // Balance and number of transactions might have changed cachedNumBlocks = nBestHeight; - if (model->getEncryptionStatus() != WalletModel::Unencrypted){ - if((nAnonymizeDarkcoinAmount*COIN)-pwalletMain->GetAnonymizedBalance() > 1.1*COIN && model->getEncryptionStatus() == WalletModel::Locked){ - WalletModel::UnlockContext ctx(model->requestUnlock()); - if(!ctx.isValid()){ - //unlock was cancelled - fDisableDarksend = true; - LogPrintf("Wallet is locked and user declined to unlock. Disabling Darksend.\n"); + if (pwalletMain->GetBalance() - pwalletMain->GetAnonymizedBalance() > 2*COIN){ + if (model->getEncryptionStatus() != WalletModel::Unencrypted){ + if((nAnonymizeDarkcoinAmount*COIN)-pwalletMain->GetAnonymizedBalance() > 1.1*COIN && model->getEncryptionStatus() == WalletModel::Locked){ + WalletModel::UnlockContext ctx(model->requestUnlock()); + if(!ctx.isValid()){ + //unlock was cancelled + fDisableDarksend = true; + LogPrintf("Wallet is locked and user declined to unlock. Disabling Darksend.\n"); + } + } + if((nAnonymizeDarkcoinAmount*COIN)-pwalletMain->GetAnonymizedBalance() <= 1.1*COIN && + model->getEncryptionStatus() == WalletModel::Unlocked && + darkSendPool.GetMyTransactionCount() == 0){ + LogPrintf("Darksend is complete, locking wallet.\n"); + model->Lock(); } - } - if((nAnonymizeDarkcoinAmount*COIN)-pwalletMain->GetAnonymizedBalance() <= 1.1*COIN && - model->getEncryptionStatus() == WalletModel::Unlocked && - darkSendPool.GetMyTransactionCount() == 0){ - LogPrintf("Darksend is complete, locking wallet.\n"); - model->Lock(); } } }