Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_disconnect_ban.py
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
self.nodes[1].setban( | self.nodes[1].setban( | ||||
"2001:4d48:ac57:400:cacf:e9ff:fe1d:9c63/19", "add", 1000) | "2001:4d48:ac57:400:cacf:e9ff:fe1d:9c63/19", "add", 1000) | ||||
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']) | ||||
# Move time forward by 3 seconds so the third ban has expired | # Move time forward by 3 seconds so the third ban has expired | ||||
self.nodes[1].setmocktime(old_time + 3) | self.nodes[1].setmocktime(old_time + 3) | ||||
assert_equal(len(self.nodes[1].listbanned()), 3) | assert_equal(len(self.nodes[1].listbanned()), 3) | ||||
self.stop_node(1) | self.restart_node(1) | ||||
self.start_node(1) | |||||
listAfterShutdown = self.nodes[1].listbanned() | listAfterShutdown = self.nodes[1].listbanned() | ||||
assert_equal("127.0.0.0/24", listAfterShutdown[0]['address']) | assert_equal("127.0.0.0/24", listAfterShutdown[0]['address']) | ||||
assert_equal("127.0.0.0/32", listAfterShutdown[1]['address']) | assert_equal("127.0.0.0/32", listAfterShutdown[1]['address']) | ||||
assert_equal("/19" in listAfterShutdown[2]['address'], True) | assert_equal("/19" in listAfterShutdown[2]['address'], True) | ||||
# Clear ban lists | # Clear ban lists | ||||
self.nodes[1].clearbanned() | self.nodes[1].clearbanned() | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |