From 3ddbf22ed179a2db733af4b521bec5d2b13ebf4b Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 1 Feb 2021 14:57:34 +0000 Subject: util: Disallow negative mocktime Signed-off-by: practicalswift --- test/functional/rpc_uptime.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/functional') 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)) -- cgit v1.2.3