Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13711302
D1424.id3902.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D1424.id3902.diff
View Options
diff --git a/test/functional/listtransactions.py b/test/functional/listtransactions.py
--- a/test/functional/listtransactions.py
+++ b/test/functional/listtransactions.py
@@ -21,7 +21,6 @@
class ListTransactionsTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
- self.enable_mocktime()
def run_test(self):
# Simple send, 0 to 1:
diff --git a/test/functional/receivedby.py b/test/functional/receivedby.py
--- a/test/functional/receivedby.py
+++ b/test/functional/receivedby.py
@@ -28,7 +28,6 @@
class ReceivedByTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
- self.enable_mocktime()
def run_test(self):
'''
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -335,17 +335,17 @@
sync_blocks(group)
sync_mempools(group)
- def enable_mocktime(self):
+ def enable_mocktime(self, mocktime):
"""Enable mocktime for the script.
mocktime may be needed for scripts that use the cached version of the
blockchain. If the cached version of the blockchain is used without
mocktime then the mempools will not sync due to IBD.
-
- For backwared compatibility of the python scripts with previous
- versions of the cache, this helper function sets mocktime to Jan 1,
- 2014 + (201 * 10 * 60)"""
- self.mocktime = 1388534400 + (201 * 10 * 60)
+ """
+ if self.mocktime == 0:
+ self.mocktime = mocktime
+ else:
+ self.log.warning("mocktime overriden by test.")
def disable_mocktime(self):
self.mocktime = 0
@@ -429,14 +429,13 @@
#
# blocks are created with timestamps 10 minutes apart
# starting from 2010 minutes in the past
- self.enable_mocktime()
- block_time = self.mocktime - (201 * 10 * 60)
+ self.enable_mocktime(int(time.time()) - (201 * 10 * 60))
for i in range(2):
for peer in range(4):
for j in range(25):
- set_node_times(self.nodes, block_time)
+ set_node_times(self.nodes, self.mocktime)
self.nodes[peer].generate(1)
- block_time += 10 * 60
+ self.mocktime += 10 * 60
# Must sync before next peer starts generating blocks
sync_blocks(self.nodes)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 26, 11:28 (16 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5573406
Default Alt Text
D1424.id3902.diff (2 KB)
Attached To
D1424: [qa] cause test_framework to mine the initial chain *now*
Event Timeline
Log In to Comment