Commit b3cecd99 authored by Pieter Wuille's avatar Pieter Wuille
Browse files

Fix wallet locking locking

parent bd67e1c2
master 14.0.0-testnet-require-standard 206-keys-hashes-opcodes 206-reg-spec-tx 211-agent-voting 89-merge-0.11-1st-stage 89-merge-bitcoin-latest-changes Current-dev NFT_HANG_HOT_FIX Testbranch add-testnet-option-to-script arm64 ashot-dev ashot-mn bitcoin-merge bitcoin-merge-wjf bitcore bitcore-current-dev bitcore-current-dev-fix-261 bitcore-v0.12.5.2 bitcore-v0.12.5.2-rc bug-template-updates build-experiments buildenv cherry-pick-61110e8c cherry-pick-9cf6a77a crown-ui current-dev-fix-261 develop-0.15 develop-platform difficulty-adjust docker-experiment evo-upgrade feature-350-asterisk-for-height fix-crown-cli fix-pi-build fix_depends_boost_location fontconfcheck issue-340-bionic-depends issue_115 issue_173 issue_371 main-testnet-integration mn-pos-fix pablon pablon-build-env patch-release-v0.12.5.3 patch_v0.13.4.1 printblock reduce-testnet-difficulty resolve-wallet-freeze spendfrom-enhancements testnet-stability v0.10.3-fix v0.14.2 v0.14.2rc2 v0.14.2rc1 v0.14.1 v0.14.1rc2 v0.14.1rc1 v0.14.0.4 v0.14.0.3 v0.14.0.2-Emerald v0.14.0.1-Emerald v0.14.0.0-Emerald v0.14.0 v0.14.0rc3 v0.14.0rc2 v0.14.0rc1 v0.13.4.0 v0.13.2.0 v0.13.2 v0.13.2rc1 v0.13.1 v0.13.1rc3 v0.13.1rc2 v0.13.1rc1 v0.13.0 v0.13.0rc3 v0.13.0rc2 v0.13.0rc1 v0.12.5.3 v0.12.5.2 v0.12.5.1 v0.12.5.0 v0.12.4.1 v0.12.4.0 v0.12.2.0 v0.12.1.0 v0.12.1 v0.12.1rc2 v0.12.1rc1 v0.12.0.61 v0.12.0 v0.12.0rc5 v0.12.0rc4 v0.12.0rc3 v0.12.0rc2 v0.12.0rc1 v0.11.3 v0.11.2 v0.11.2rc1 v0.11.1 v0.11.1rc2 v0.11.1rc1 v0.11.0 v0.11.0rc3 v0.11.0rc2 v0.11.0rc1 v0.10.5 v0.10.4 v0.10.4rc1 v0.10.3 v0.10.3rc2 v0.10.3rc1 v0.10.2 v0.10.2rc1 v0.10.1 v0.10.1rc3 v0.10.1rc2 v0.10.1rc1 v0.10.0 v0.10.0rc4 v0.10.0rc3 v0.10.0rc2 v0.10.0rc1 v0.9.5 v0.9.5rc2 v0.9.5rc1 v0.9.4 v0.9.3.5 v0.9.3 v0.9.3rc2 v0.9.3rc1 v0.9.2.1 v0.9.2 v0.9.2rc2 v0.9.2rc1 v0.9.1 v0.9.0 v0.9.0rc3 v0.9.0rc2 v0.9.0rc1 v0.8.6 v0.8.6rc1 v0.8.5 v0.8.4 v0.8.4rc2 v0.8.3 v0.8.2 v0.8.2rc3 v0.8.2rc2 v0.8.2rc1 v0.8.1 v0.8.0 v0.8.0rc1 v0.7.2 v0.7.2rc2 v0.7.1 v0.7.1rc1 v0.7.0 v0.7.0rc3 v0.7.0rc2 v0.7.0rc1 v0.6.3 v0.6.3rc1 v0.6.2.2 v0.6.2.1 v0.6.2 v0.6.1 v0.6.1rc2 v0.6.1rc1 v0.6.0 v0.6.0rc6 v0.6.0rc5 v0.6.0rc4 v0.6.0rc3 v0.6.0rc2 bitcore-bin-006 bitcore-bin-005 bitcore-bin-004 bitcore-bin-003 bitcore-bin-002 bitcore-bin-001
No related merge requests found
Showing with 14 additions and 16 deletions
+14 -16
......@@ -1539,33 +1539,31 @@ void ThreadCleanWalletPassphrase(void* parg)
{
int64 nMyWakeTime = GetTime() + *((int*)parg);
ENTER_CRITICAL_SECTION(cs_nWalletUnlockTime);
if (nWalletUnlockTime == 0)
{
CRITICAL_BLOCK(cs_nWalletUnlockTime)
{
nWalletUnlockTime = nMyWakeTime;
}
nWalletUnlockTime = nMyWakeTime;
while (GetTime() < nWalletUnlockTime)
Sleep(GetTime() - nWalletUnlockTime);
CRITICAL_BLOCK(cs_nWalletUnlockTime)
{
nWalletUnlockTime = 0;
int64 nToSleep = GetTime() - nWalletUnlockTime;
LEAVE_CRITICAL_SECTION(cs_nWalletUnlockTime);
Sleep(nToSleep);
ENTER_CRITICAL_SECTION(cs_nWalletUnlockTime);
}
nWalletUnlockTime = 0;
pwalletMain->Lock();
}
else
{
CRITICAL_BLOCK(cs_nWalletUnlockTime)
{
if (nWalletUnlockTime < nMyWakeTime)
nWalletUnlockTime = nMyWakeTime;
}
delete (int*)parg;
return;
if (nWalletUnlockTime < nMyWakeTime)
nWalletUnlockTime = nMyWakeTime;
}
pwalletMain->Lock();
LEAVE_CRITICAL_SECTION(cs_nWalletUnlockTime);
delete (int*)parg;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment