https://travis-ci.org/github/MarcoFalke/btc_nightly/jobs/680655419#L412
LOCK(pwallet->cs_wallet);
        if (!pwallet->IsCrypted()) {
            throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletpassphrase was called.");
        }
        
        SecureString strWalletPass;
        strWalletPass.reserve(100);
        
        
        strWalletPass = request.params[0].get_str().c_str();
        
        nSleepTime = request.params[1].get_int64();
        
        if (nSleepTime < 0) {
            throw JSONRPCError(RPC_INVALID_PARAMETER, "Timeout cannot be negative.");
        }
        
        constexpr int64_t MAX_SLEEP_TIME = 100000000; 
        if (nSleepTime > MAX_SLEEP_TIME) {
            nSleepTime = MAX_SLEEP_TIME;
        }
        if (strWalletPass.empty()) {
            throw JSONRPCError(RPC_INVALID_PARAMETER, "passphrase can not be empty");
        }
        if (!pwallet->Unlock(strWalletPass)) {
            throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect.");
        }
        pwallet->TopUpKeyPool();
        pwallet->nRelockTime = GetTime() + nSleepTime;
    }