aboutsummaryrefslogtreecommitdiff
path: root/src/rpc.cpp
diff options
context:
space:
mode:
authorMatt Corallo <[email protected]>2011-06-29 00:47:41 +0200
committerMatt Corallo <[email protected]>2011-07-13 02:11:25 +0200
commit98545d2cdf53f7b6f32eba7a7f51034a9ca994c2 (patch)
treedc9714c86a068f7236208e642273ec1b0dae5165 /src/rpc.cpp
parentSet the number of SHA512 rounds based on the speed of the computer. (diff)
downloaddiscoin-98545d2cdf53f7b6f32eba7a7f51034a9ca994c2.tar.xz
discoin-98545d2cdf53f7b6f32eba7a7f51034a9ca994c2.zip
Push unlocked_until in getinfo.
Diffstat (limited to 'src/rpc.cpp')
-rw-r--r--src/rpc.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/rpc.cpp b/src/rpc.cpp
index 3a573043f..5965fef43 100644
--- a/src/rpc.cpp
+++ b/src/rpc.cpp
@@ -36,6 +36,9 @@ void ThreadRPCServer2(void* parg);
typedef Value(*rpcfn_type)(const Array& params, bool fHelp);
extern map<string, rpcfn_type> mapCallTable;
+static int64 nWalletUnlockTime;
+static CCriticalSection cs_nWalletUnlockTime;
+
Object JSONRPCError(int code, const string& message)
{
@@ -311,6 +314,8 @@ Value getinfo(const Array& params, bool fHelp)
obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime()));
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("errors", GetWarnings("statusbar")));
return obj;
}
@@ -1360,31 +1365,29 @@ void ThreadTopUpKeyPool(void* parg)
void ThreadCleanWalletPassphrase(void* parg)
{
- static int64 nWakeTime;
int64 nMyWakeTime = GetTime() + *((int*)parg);
- static CCriticalSection cs_nWakeTime;
- if (nWakeTime == 0)
+ if (nWalletUnlockTime == 0)
{
- CRITICAL_BLOCK(cs_nWakeTime)
+ CRITICAL_BLOCK(cs_nWalletUnlockTime)
{
- nWakeTime = nMyWakeTime;
+ nWalletUnlockTime = nMyWakeTime;
}
- while (GetTime() < nWakeTime)
- Sleep(GetTime() - nWakeTime);
+ while (GetTime() < nWalletUnlockTime)
+ Sleep(GetTime() - nWalletUnlockTime);
- CRITICAL_BLOCK(cs_nWakeTime)
+ CRITICAL_BLOCK(cs_nWalletUnlockTime)
{
- nWakeTime = 0;
+ nWalletUnlockTime = 0;
}
}
else
{
- CRITICAL_BLOCK(cs_nWakeTime)
+ CRITICAL_BLOCK(cs_nWalletUnlockTime)
{
- if (nWakeTime < nMyWakeTime)
- nWakeTime = nMyWakeTime;
+ if (nWalletUnlockTime < nMyWakeTime)
+ nWalletUnlockTime = nMyWakeTime;
}
free(parg);
return;