Changeset View
Changeset View
Standalone View
Standalone View
test/functional/maxuploadtarget.py
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# test_nodes[1] will only request new blocks | # test_nodes[1] will only request new blocks | ||||
# test_nodes[2] will test resetting the counters | # test_nodes[2] will test resetting the counters | ||||
test_nodes = [] | test_nodes = [] | ||||
connections = [] | connections = [] | ||||
for i in range(3): | for i in range(3): | ||||
test_nodes.append(TestNode()) | test_nodes.append(TestNode()) | ||||
connections.append( | connections.append( | ||||
NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], test_nodes[i])) | NodeConn('127.0.0.1', self.p2p_port(0), self.nodes[0], test_nodes[i])) | ||||
test_nodes[i].add_connection(connections[i]) | test_nodes[i].add_connection(connections[i]) | ||||
# Start up network handling in another thread | # Start up network handling in another thread | ||||
NetworkThread().start() | NetworkThread().start() | ||||
[x.wait_for_verack() for x in test_nodes] | [x.wait_for_verack() for x in test_nodes] | ||||
# Test logic begins here | # Test logic begins here | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# stop and start node 0 with 1MB maxuploadtarget, whitelist 127.0.0.1 | # stop and start node 0 with 1MB maxuploadtarget, whitelist 127.0.0.1 | ||||
self.log.info("Restarting nodes with -whitelist=127.0.0.1") | self.log.info("Restarting nodes with -whitelist=127.0.0.1") | ||||
self.stop_node(0) | self.stop_node(0) | ||||
self.start_node(0, ["-whitelist=127.0.0.1", | self.start_node(0, ["-whitelist=127.0.0.1", | ||||
"-maxuploadtarget=1", "-blockmaxsize=999000"]) | "-maxuploadtarget=1", "-blockmaxsize=999000"]) | ||||
# recreate/reconnect a test node | # recreate/reconnect a test node | ||||
test_nodes = [TestNode()] | test_nodes = [TestNode()] | ||||
connections = [NodeConn('127.0.0.1', p2p_port( | connections = [NodeConn('127.0.0.1', self.p2p_port( | ||||
0), self.nodes[0], test_nodes[0])] | 0), self.nodes[0], test_nodes[0])] | ||||
test_nodes[0].add_connection(connections[0]) | test_nodes[0].add_connection(connections[0]) | ||||
NetworkThread().start() # Start up network handling in another thread | NetworkThread().start() # Start up network handling in another thread | ||||
test_nodes[0].wait_for_verack() | test_nodes[0].wait_for_verack() | ||||
# retrieve 20 blocks which should be enough to break the 1MB limit | # retrieve 20 blocks which should be enough to break the 1MB limit | ||||
getdata_request.inv = [CInv(2, big_new_block)] | getdata_request.inv = [CInv(2, big_new_block)] | ||||
Show All 16 Lines |