Skip to content
Bitcoin Roots

v29.4-roots.1 · Commit 10: [PATCH 10/13] fix: harden final Roots assurance

test/functional/rpc_uptime.py

Before: test/functional/rpc_uptime.py · After: test/functional/rpc_uptime.py

File metadata
index fdf459953c006bed00607f447106253c32287fb8..8ab82f50e7ff3ab658977ab380cd63862cc4459d 100755

Download original patch · Release notes

Diff rows 1–26 of 26. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

test/functional/rpc_uptime.py CHANGED
@@ -7,10 +7,11 @@
7
7
  Test corresponds to code in rpc/server.cpp.
8
8
  """
9
9
 
10
- import time
11
-
12
10
  from test_framework.test_framework import BitcoinTestFramework
13
- from test_framework.util import assert_raises_rpc_error
11
+ from test_framework.util import (
12
+ assert_greater_than_or_equal,
13
+ assert_raises_rpc_error,
14
+ )
14
15
 
15
16
 
16
17
  class UptimeTest(BitcoinTestFramework):
@@ -26,9 +27,9 @@ class UptimeTest(BitcoinTestFramework):
26
27
  assert_raises_rpc_error(-8, "Mocktime must be in the range [0, 9223372036], not -1.", self.nodes[0].setmocktime, -1)
27
28
 
28
29
  def _test_uptime(self):
29
- wait_time = 10
30
- self.nodes[0].setmocktime(int(time.time() + wait_time))
31
- assert self.nodes[0].uptime() >= wait_time
30
+ uptime_before = self.nodes[0].uptime()
31
+ self.nodes[0].setmocktime(10)
32
+ assert_greater_than_or_equal(self.nodes[0].uptime(), uptime_before)
32
33
 
33
34
 
34
35
  if __name__ == '__main__':