diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-02-01 14:57:34 +0000 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-02-11 12:42:40 +0100 |
commit | 08dada84565ea5f49127123e356c82a150626f3c (patch) | |
tree | f118994b26354a51f0209c8c758c393aec464416 /test/functional/rpc_uptime.py | |
parent | 95218ee95cdb4046ee7d622eac822e74d94314c7 (diff) |
util: Disallow negative mocktime
Signed-off-by: practicalswift <practicalswift@users.noreply.github.com>
Github-Pull: #21043
Rebased-From: 3ddbf22ed179a2db733af4b521bec5d2b13ebf4b
Diffstat (limited to 'test/functional/rpc_uptime.py')
-rwxr-xr-x | test/functional/rpc_uptime.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/functional/rpc_uptime.py b/test/functional/rpc_uptime.py index e86f91b1d0..6177970872 100755 --- a/test/functional/rpc_uptime.py +++ b/test/functional/rpc_uptime.py @@ -10,6 +10,7 @@ Test corresponds to code in rpc/server.cpp. import time from test_framework.test_framework import BitcoinTestFramework +from test_framework.util import assert_raises_rpc_error class UptimeTest(BitcoinTestFramework): @@ -18,8 +19,12 @@ class UptimeTest(BitcoinTestFramework): self.setup_clean_chain = True def run_test(self): + self._test_negative_time() self._test_uptime() + def _test_negative_time(self): + assert_raises_rpc_error(-8, "Mocktime can not be negative: -1.", self.nodes[0].setmocktime, -1) + def _test_uptime(self): wait_time = 10 self.nodes[0].setmocktime(int(time.time() + wait_time)) |