Skip to content

Commit

Permalink
wallet: allowing walletpassphrase timeout to be set to MAX_SLEEP_TIME
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kevkevinpal committed Sep 12, 2023
1 parent 8f7b9eb commit 54acb38
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/wallet/rpc/encrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 54acb38

Please sign in to comment.