[tests] TestNode: separate add_node from start_node
Separates the act of creating a TestNode object from starting the node. The test_framework now keeps track of its list of TestNodes, and test writers can call start_node() and stop_node() without having to update the self.nodes list.
This commit is contained in:
1 parent
be2a2ab6a6
commit
36b6268670
36 files changed
+205
-200
No files matched your search
@@ -63,9 +63,8 @@ class MempoolPersistTest(BitcoinTestFramework):
|
||||
|
||||
self.log.debug("Stop-start node0 and node1. Verify that node0 has the transactions in its mempool and node1 does not.")
|
||||
self.stop_nodes()
|
||||
self.nodes = []
|
||||
self.nodes.append(self.start_node(0, self.options.tmpdir))
|
||||
self.nodes.append(self.start_node(1, self.options.tmpdir))
|
||||
self.start_node(0)
|
||||
self.start_node(1)
|
||||
# Give bitcoind a second to reload the mempool
|
||||
time.sleep(1)
|
||||
wait_until(lambda: len(self.nodes[0].getrawmempool()) == 5)
|
||||
@@ -73,16 +72,14 @@ class MempoolPersistTest(BitcoinTestFramework):
|
||||
|
||||
self.log.debug("Stop-start node0 with -persistmempool=0. Verify that it doesn't load its mempool.dat file.")
|
||||
self.stop_nodes()
|
||||
self.nodes = []
|
||||
self.nodes.append(self.start_node(0, self.options.tmpdir, ["-persistmempool=0"]))
|
||||
self.start_node(0, extra_args=["-persistmempool=0"])
|
||||
# Give bitcoind a second to reload the mempool
|
||||
time.sleep(1)
|
||||
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
||||
|
||||
self.log.debug("Stop-start node0. Verify that it has the transactions in its mempool.")
|
||||
self.stop_nodes()
|
||||
self.nodes = []
|
||||
self.nodes.append(self.start_node(0, self.options.tmpdir))
|
||||
self.start_node(0)
|
||||
wait_until(lambda: len(self.nodes[0].getrawmempool()) == 5)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in new issue
Block a user