Skip to content

Commit

Permalink
Merge bitcoin#14738: Tests: Fix running wallet_listtransactions.py in…
Browse files Browse the repository at this point in the history
…dividually through test_runner.py

2474de0 Fix running individually through test_runner.py, as suggested by @MarcoFalke (bitcoin#14732) (Kristaps Kaupe)

Pull request description:

  As suggested by @MarcoFalke. Resolves bitcoin#14732.

Tree-SHA512: b4e400ba06075e218dbd97d0390845f1c55be42a2b6fd70513381318cfc2693473ba1d0f9d7f379a96939d1960b53801fad7c02e06bddc50c5a835ad024c37ef
  • Loading branch information
MarcoFalke authored and Munkybooty committed Mar 6, 2022
1 parent 16876de commit b9c7345
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions test/functional/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,6 @@ def sync_all(self, nodes=None, **kwargs):
self.sync_blocks(nodes, **kwargs)
self.sync_mempools(nodes, **kwargs)

def disable_mocktime(self):
self.mocktime = 0
for node in self.nodes:
node.mocktime = 0

def bump_mocktime(self, t, update_nodes=True, nodes=None):
self.mocktime += t
if update_nodes:
Expand Down Expand Up @@ -591,6 +586,11 @@ def _initialize_chain(self, extra_args=None):
for node in self.nodes:
node.wait_for_rpc_connection()

# For backward compatibility of the python scripts with previous
# versions of the cache, set mocktime to Jan 1,
# 2014 + (201 * 10 * 60)"""
self.mocktime = 1388534400 + (201 * 10 * 60)

# Create a 200-block-long chain; each of the 4 first nodes
# gets 25 mature blocks and 25 immature.
# Note: To preserve compatibility with older versions of
Expand All @@ -611,7 +611,7 @@ def _initialize_chain(self, extra_args=None):
# Shut them down, and clean up cache directories:
self.stop_nodes()
self.nodes = []
self.disable_mocktime()
self.mocktime = 0

def cache_path(n, *paths):
chain = get_chain_folder(get_datadir_path(self.options.cachedir, n), self.chain)
Expand Down
3 changes: 2 additions & 1 deletion test/functional/wallet_listtransactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
class ListTransactionsTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
self.set_cache_mocktime()

def skip_test_if_missing_module(self):
self.skip_if_no_wallet()

def run_test(self):
self.nodes[0].generate(1) # Get out of IBD
self.sync_all()
# Simple send, 0 to 1:
txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1)
self.sync_all()
Expand Down

0 comments on commit b9c7345

Please sign in to comment.