|
|
@ -64,14 +64,15 @@ class WalletEncryptionTest(BitcoinTestFramework):
|
|
|
|
assert_raises_rpc_error(-8, "Timeout cannot be negative.", self.nodes[0].walletpassphrase, passphrase2, -10)
|
|
|
|
assert_raises_rpc_error(-8, "Timeout cannot be negative.", self.nodes[0].walletpassphrase, passphrase2, -10)
|
|
|
|
# Check the timeout
|
|
|
|
# Check the timeout
|
|
|
|
# Check a time less than the limit
|
|
|
|
# Check a time less than the limit
|
|
|
|
expected_time = int(time.time()) + (1 << 30) - 600
|
|
|
|
MAX_VALUE = 100000000
|
|
|
|
self.nodes[0].walletpassphrase(passphrase2, (1 << 30) - 600)
|
|
|
|
expected_time = int(time.time()) + MAX_VALUE - 600
|
|
|
|
|
|
|
|
self.nodes[0].walletpassphrase(passphrase2, MAX_VALUE - 600)
|
|
|
|
actual_time = self.nodes[0].getwalletinfo()['unlocked_until']
|
|
|
|
actual_time = self.nodes[0].getwalletinfo()['unlocked_until']
|
|
|
|
assert_greater_than_or_equal(actual_time, expected_time)
|
|
|
|
assert_greater_than_or_equal(actual_time, expected_time)
|
|
|
|
assert_greater_than(expected_time + 5, actual_time) # 5 second buffer
|
|
|
|
assert_greater_than(expected_time + 5, actual_time) # 5 second buffer
|
|
|
|
# Check a time greater than the limit
|
|
|
|
# Check a time greater than the limit
|
|
|
|
expected_time = int(time.time()) + (1 << 30) - 1
|
|
|
|
expected_time = int(time.time()) + MAX_VALUE - 1
|
|
|
|
self.nodes[0].walletpassphrase(passphrase2, (1 << 33))
|
|
|
|
self.nodes[0].walletpassphrase(passphrase2, MAX_VALUE + 1000)
|
|
|
|
actual_time = self.nodes[0].getwalletinfo()['unlocked_until']
|
|
|
|
actual_time = self.nodes[0].getwalletinfo()['unlocked_until']
|
|
|
|
assert_greater_than_or_equal(actual_time, expected_time)
|
|
|
|
assert_greater_than_or_equal(actual_time, expected_time)
|
|
|
|
assert_greater_than(expected_time + 5, actual_time) # 5 second buffer
|
|
|
|
assert_greater_than(expected_time + 5, actual_time) # 5 second buffer
|
|
|
|