From 54acb388e7e57c248ea2df54bf850e567a1c96de Mon Sep 17 00:00:00 2001 From: kevkevin Date: Mon, 11 Sep 2023 15:58:54 -0500 Subject: [PATCH] wallet: allowing walletpassphrase timeout to be set to MAX_SLEEP_TIME In this change we allow the timeout for walletpassphrase to be set to MAX_SLEEP_TIME, if set as 0 then we then use the MAX_SLEEP_TIME amount context from PR 28403 --- src/wallet/rpc/encrypt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpc/encrypt.cpp b/src/wallet/rpc/encrypt.cpp index 0226d15698bab..a79f403dd9d4d 100644 --- a/src/wallet/rpc/encrypt.cpp +++ b/src/wallet/rpc/encrypt.cpp @@ -18,7 +18,7 @@ RPCHelpMan walletpassphrase() "time that overrides the old one.\n", { {"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet passphrase"}, - {"timeout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The time to keep the decryption key in seconds; capped at 100000000 (~3 years)."}, + {"timeout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The time to keep the decryption key in seconds; capped at 100000000 (~3 years), will use cap if 0 specified"}, }, RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{ @@ -59,7 +59,7 @@ RPCHelpMan walletpassphrase() } // Clamp timeout constexpr int64_t MAX_SLEEP_TIME = 100000000; // larger values trigger a macos/libevent bug? - if (nSleepTime > MAX_SLEEP_TIME) { + if (nSleepTime > MAX_SLEEP_TIME || nSleepTime == 0) { nSleepTime = MAX_SLEEP_TIME; }