Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p-acceptblock.py
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | class AcceptBlockTest(BitcoinTestFramework): | ||||
def run_test(self): | def run_test(self): | ||||
# Setup the p2p connections and start up the network thread. | # Setup the p2p connections and start up the network thread. | ||||
test_node = NodeConnCB() # connects to node0 (not whitelisted) | test_node = NodeConnCB() # connects to node0 (not whitelisted) | ||||
white_node = NodeConnCB() # connects to node1 (whitelisted) | white_node = NodeConnCB() # connects to node1 (whitelisted) | ||||
min_work_node = NodeConnCB() # connects to node2 (not whitelisted) | min_work_node = NodeConnCB() # connects to node2 (not whitelisted) | ||||
connections = [] | connections = [] | ||||
connections.append( | connections.append( | ||||
NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], test_node)) | NodeConn('127.0.0.1', self.p2p_port(0), self.nodes[0], test_node)) | ||||
connections.append( | connections.append( | ||||
NodeConn('127.0.0.1', p2p_port(1), self.nodes[1], white_node)) | NodeConn('127.0.0.1', self.p2p_port(1), self.nodes[1], white_node)) | ||||
connections.append(NodeConn('127.0.0.1', p2p_port(2), | connections.append(NodeConn('127.0.0.1', self.p2p_port(2), | ||||
self.nodes[2], min_work_node)) | self.nodes[2], min_work_node)) | ||||
test_node.add_connection(connections[0]) | test_node.add_connection(connections[0]) | ||||
white_node.add_connection(connections[1]) | white_node.add_connection(connections[1]) | ||||
min_work_node.add_connection(connections[2]) | min_work_node.add_connection(connections[2]) | ||||
NetworkThread().start() # Start up network handling in another thread | NetworkThread().start() # Start up network handling in another thread | ||||
# Test logic begins here | # Test logic begins here | ||||
▲ Show 20 Lines • Show All 165 Lines • Show Last 20 Lines |