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