Fix disconnect_ban.py

We run tests in mocked time, need to bump it here for "remove from ban list after 1 sec" logic to triger.
This commit is contained in:
UdjinM6 2019-05-28 13:56:48 +03:00 committed by Pasta
parent e6a0b2162b
commit 788973a8a6
No known key found for this signature in database
GPG Key ID: 0B8EB7A31A44D9C6

View File

@ -11,6 +11,9 @@ from test_framework.util import (assert_equal,
connect_nodes_bi, connect_nodes_bi,
start_node, start_node,
stop_node, stop_node,
set_mocktime,
get_mocktime,
set_node_times,
) )
class DisconnectBanTest(BitcoinTestFramework): class DisconnectBanTest(BitcoinTestFramework):
@ -64,6 +67,8 @@ class DisconnectBanTest(BitcoinTestFramework):
self.nodes[1].setban("2001:4d48:ac57:400:cacf:e9ff:fe1d:9c63/19", "add", 1000) # ban for 1000 seconds self.nodes[1].setban("2001:4d48:ac57:400:cacf:e9ff:fe1d:9c63/19", "add", 1000) # ban for 1000 seconds
listBeforeShutdown = self.nodes[1].listbanned() listBeforeShutdown = self.nodes[1].listbanned()
assert_equal("192.168.0.1/32", listBeforeShutdown[2]['address']) assert_equal("192.168.0.1/32", listBeforeShutdown[2]['address'])
set_mocktime(get_mocktime() + 2)
set_node_times(self.nodes, get_mocktime())
wait_until(lambda: len(self.nodes[1].listbanned()) == 3) wait_until(lambda: len(self.nodes[1].listbanned()) == 3)
stop_node(self.nodes[1], 1) stop_node(self.nodes[1], 1)