message: [RPC] Sanitize walletpassphrase timeout argument
  Properly return an error when attempting to use a negative timeout. Also
  sanitize the timeout so as to not cause a value error with libevent on
  MacOS.
diff: @@ -1798,15 +1798,23 @@ UniValue walletpassphrase(const UniValue& params, bool fHelp)
  if (!pwalletMain->IsLocked() && pwalletMain->fWalletUnlockAnonymizeOnly && anonymizeOnly)
  throw JSONRPCError(RPC_WALLET_ALREADY_UNLOCKED, "Error: Wallet is already unlocked.");
  + // Get the timeout
  + int64_t nSleepTime = params[1].get_int64();
  + // Timeout cannot be negative, otherwise it will relock immediately
  + if (nSleepTime < 0) {
  + throw JSONRPCError(RPC_INVALID_PARAMETER, "Timeout cannot be negative.");
  + }
  + // Clamp timeout
  + constexpr int64_t MAX_SLEEP_TIME = 100000000; // larger values trigger a macos/libevent bug?
  + if (nSleepTime > MAX_SLEEP_TIME) {
  + nSleepTime = MAX_SLEEP_TIME;
  + }
  +
  if (!pwalletMain->Unlock(strWalletPass, anonymizeOnly))
  throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect.");
  pwalletMain->TopUpKeyPool();
  - int64_t nSleepTime = params[1].get_int64();
  - LOCK(cs_nWalletUnlockTime);
  - nWalletUnlockTime = GetTime() + nSleepTime;
  -
  if (nSleepTime > 0) {
  nWalletUnlockTime = GetTime () + nSleepTime;
  RPCRunLater ("lockwallet", boost::bind (LockWallet, pwalletMain), nSleepTime);
  