aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_encryption.py
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2018-04-06 11:54:52 -0400
committerSuhas Daftuar <sdaftuar@gmail.com>2018-04-08 10:44:40 -0400
commit662d19ff7217d0e6c7975ca311933f640955a53e (patch)
tree7fc68d02f388490c3a2b6d03d5ebbf3b2f3e0409 /test/functional/wallet_encryption.py
parent1d540046fe47eb7b6062c55ebebd801ece96231c (diff)
[rpcwallet] Clamp walletpassphrase value at 100M seconds
Larger values seem to trigger a bug on macos+libevent (resulting in the rpc server stopping).
Diffstat (limited to 'test/functional/wallet_encryption.py')
-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