aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2018-04-06 11:54:52 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-07-12 10:03:03 -0400
commitcfc6f7413bfa486aed9811fcef177cd80568f2db (patch)
tree16277a8a14925570983ed76a10e3f2eda0be4fc0 /test
parentbf1f1501903a2a0df4ac5fd4b2bfe086ffe88773 (diff)
[rpcwallet] Clamp walletpassphrase value at 100M seconds
Larger values seem to trigger a bug on macos+libevent (resulting in the rpc server stopping). Github-Pull: #12905 Rebased-From: 662d19ff7217d0e6c7975ca311933f640955a53e
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/wallet_encryption.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/functional/wallet_encryption.py b/test/functional/wallet_encryption.py
index 3c927ee484..64ee678744 100755
--- a/test/functional/wallet_encryption.py
+++ b/test/functional/wallet_encryption.py
@@ -64,14 +64,15 @@ class WalletEncryptionTest(BitcoinTestFramework):
assert_raises_rpc_error(-8, "Timeout cannot be negative.", self.nodes[0].walletpassphrase, passphrase2, -10)
# Check the timeout
# Check a time less than the limit
- expected_time = int(time.time()) + (1 << 30) - 600
- self.nodes[0].walletpassphrase(passphrase2, (1 << 30) - 600)
+ MAX_VALUE = 100000000
+ expected_time = int(time.time()) + MAX_VALUE - 600
+ self.nodes[0].walletpassphrase(passphrase2, MAX_VALUE - 600)
actual_time = self.nodes[0].getwalletinfo()['unlocked_until']
assert_greater_than_or_equal(actual_time, expected_time)
assert_greater_than(expected_time + 5, actual_time) # 5 second buffer
# Check a time greater than the limit
- expected_time = int(time.time()) + (1 << 30) - 1
- self.nodes[0].walletpassphrase(passphrase2, (1 << 33))
+ expected_time = int(time.time()) + MAX_VALUE - 1
+ self.nodes[0].walletpassphrase(passphrase2, MAX_VALUE + 1000)
actual_time = self.nodes[0].getwalletinfo()['unlocked_until']
assert_greater_than_or_equal(actual_time, expected_time)
assert_greater_than(expected_time + 5, actual_time) # 5 second buffer