Page MenuHomePhabricator

Clamp walletpassphrase timeout to 2^(30) seconds and check its bounds
ClosedPublic

Authored by Fabien on Jun 27 2019, 15:51.

Details

Summary
Clamps the timeout of walletpassphrase to 2^(30) seconds, which is
~34 years. Any number greater than that will be forced to be
2^(30). This avoids the sign flipping problem with large values which
can result in a negative time used.

Also perform bounds checks to ensure that the timeout is positive
to avoid immediate relocking of the wallet.

Backport of core PR12101 and PR12905 (fix for OSX)
https://github.com/bitcoin/bitcoin/pull/12101/files
https://github.com/bitcoin/bitcoin/pull/12905/files

Due to the fix from D2633 enabling mocktime, the test will fail using
time.time() as a reference. The mocktime is used instead to get rid of
the issue.

Test Plan
./test/functional/test_runner.py wallet_encryption

Diff Detail

Repository
rABC Bitcoin ABC
Branch
PR12101
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 6506
Build 11059: Bitcoin ABC Buildbot (legacy)
Build 11058: arc lint + arc unit