aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-02-01 14:57:34 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2021-02-02 08:43:19 +0000
commit3ddbf22ed179a2db733af4b521bec5d2b13ebf4b (patch)
tree32d4bd53eec1c735bd1952312e527c578fa8623b /test/functional
parentf5f2f9716885e7548809e77f46b493c896a019bf (diff)
util: Disallow negative mocktime
Signed-off-by: practicalswift <practicalswift@users.noreply.github.com>
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/rpc_uptime.py5
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))