|
|
|
@ -353,7 +353,7 @@ Value getinfo(const Array& params, bool fHelp)
@@ -353,7 +353,7 @@ Value getinfo(const Array& params, bool fHelp)
|
|
|
|
|
obj.push_back(Pair("keypoolsize", pwalletMain->GetKeyPoolSize())); |
|
|
|
|
obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee))); |
|
|
|
|
if (pwalletMain->IsCrypted()) |
|
|
|
|
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime)); |
|
|
|
|
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime / 1000)); |
|
|
|
|
obj.push_back(Pair("errors", GetWarnings("statusbar"))); |
|
|
|
|
return obj; |
|
|
|
|
} |
|
|
|
@ -1537,35 +1537,41 @@ void ThreadTopUpKeyPool(void* parg)
@@ -1537,35 +1537,41 @@ void ThreadTopUpKeyPool(void* parg)
|
|
|
|
|
|
|
|
|
|
void ThreadCleanWalletPassphrase(void* parg) |
|
|
|
|
{ |
|
|
|
|
int64 nMyWakeTime = GetTime() + *((int*)parg); |
|
|
|
|
int64 nMyWakeTime = GetTimeMillis() + *((int*)parg) * 1000; |
|
|
|
|
|
|
|
|
|
ENTER_CRITICAL_SECTION(cs_nWalletUnlockTime); |
|
|
|
|
|
|
|
|
|
if (nWalletUnlockTime == 0) |
|
|
|
|
{ |
|
|
|
|
CRITICAL_BLOCK(cs_nWalletUnlockTime) |
|
|
|
|
nWalletUnlockTime = nMyWakeTime; |
|
|
|
|
|
|
|
|
|
do |
|
|
|
|
{ |
|
|
|
|
nWalletUnlockTime = nMyWakeTime; |
|
|
|
|
} |
|
|
|
|
if (nWalletUnlockTime==0) |
|
|
|
|
break; |
|
|
|
|
int64 nToSleep = nWalletUnlockTime - GetTimeMillis(); |
|
|
|
|
if (nToSleep <= 0) |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
LEAVE_CRITICAL_SECTION(cs_nWalletUnlockTime); |
|
|
|
|
Sleep(nToSleep); |
|
|
|
|
ENTER_CRITICAL_SECTION(cs_nWalletUnlockTime); |
|
|
|
|
|
|
|
|
|
while (GetTime() < nWalletUnlockTime) |
|
|
|
|
Sleep(GetTime() - nWalletUnlockTime); |
|
|
|
|
} while(1); |
|
|
|
|
|
|
|
|
|
CRITICAL_BLOCK(cs_nWalletUnlockTime) |
|
|
|
|
if (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; |
|
|
|
|
} |
|
|
|
@ -1655,9 +1661,9 @@ Value walletlock(const Array& params, bool fHelp)
@@ -1655,9 +1661,9 @@ Value walletlock(const Array& params, bool fHelp)
|
|
|
|
|
if (!pwalletMain->IsCrypted()) |
|
|
|
|
throw JSONRPCError(-15, "Error: running with an unencrypted wallet, but walletlock was called."); |
|
|
|
|
|
|
|
|
|
pwalletMain->Lock(); |
|
|
|
|
CRITICAL_BLOCK(cs_nWalletUnlockTime) |
|
|
|
|
{ |
|
|
|
|
pwalletMain->Lock(); |
|
|
|
|
nWalletUnlockTime = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|