@ -29,9 +29,6 @@
using namespace std ;
int64_t nWalletUnlockTime ;
static CCriticalSection cs_nWalletUnlockTime ;
CWallet * GetWalletForJSONRPCRequest ( const JSONRPCRequest & request )
{
return pwalletMain ;
@ -2004,8 +2001,8 @@ UniValue keypoolrefill(const JSONRPCRequest& request)
static void LockWallet ( CWallet * pWallet )
{
LOCK ( cs_nWalletUnlockTime ) ;
nWalletUn lockTime = 0 ;
LOCK ( pWallet- > cs_wallet ) ;
pWallet- > nRe lockTime = 0 ;
pWallet - > Lock ( ) ;
}
@ -2063,9 +2060,8 @@ UniValue walletpassphrase(const JSONRPCRequest& request)
pwallet - > TopUpKeyPool ( ) ;
int64_t nSleepTime = request . params [ 1 ] . get_int64 ( ) ;
LOCK ( cs_nWalletUnlockTime ) ;
nWalletUnlockTime = GetTime ( ) + nSleepTime ;
RPCRunLater ( " lockwallet " , boost : : bind ( LockWallet , pwallet ) , nSleepTime ) ;
pwallet - > nRelockTime = GetTime ( ) + nSleepTime ;
RPCRunLater ( strprintf ( " lockwallet_%u " , uintptr_t ( pwallet ) ) , boost : : bind ( LockWallet , pwallet ) , nSleepTime ) ;
return NullUniValue ;
}
@ -2150,11 +2146,8 @@ UniValue walletlock(const JSONRPCRequest& request)
if ( ! pwallet - > IsCrypted ( ) )
throw JSONRPCError ( RPC_WALLET_WRONG_ENC_STATE , " Error: running with an unencrypted wallet, but walletlock was called. " ) ;
{
LOCK ( cs_nWalletUnlockTime ) ;
pwallet - > Lock ( ) ;
nWalletUnlockTime = 0 ;
}
pwallet - > Lock ( ) ;
pwallet - > nRelockTime = 0 ;
return NullUniValue ;
}
@ -2430,7 +2423,7 @@ UniValue getwalletinfo(const JSONRPCRequest& request)
obj . push_back ( Pair ( " keypoololdest " , pwallet - > GetOldestKeyPoolTime ( ) ) ) ;
obj . push_back ( Pair ( " keypoolsize " , ( int ) pwallet - > GetKeyPoolSize ( ) ) ) ;
if ( pwallet - > IsCrypted ( ) )
obj . push_back ( Pair ( " unlocked_until " , nWalletUn lockTime) ) ;
obj . push_back ( Pair ( " unlocked_until " , pwallet- > nRe lockTime) ) ;
obj . push_back ( Pair ( " paytxfee " , ValueFromAmount ( payTxFee . GetFeePerK ( ) ) ) ) ;
CKeyID masterKeyID = pwallet - > GetHDChain ( ) . masterKeyID ;
if ( ! masterKeyID . IsNull ( ) )