Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_tx_download.py
Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | def test_in_flight_max(self): | ||||
wait_until(lambda: p.tx_getdata_count == MAX_GETDATA_IN_FLIGHT + 2) | wait_until(lambda: p.tx_getdata_count == MAX_GETDATA_IN_FLIGHT + 2) | ||||
self.nodes[0].setmocktime(0) | self.nodes[0].setmocktime(0) | ||||
def test_spurious_notfound(self): | def test_spurious_notfound(self): | ||||
self.log.info('Check that spurious notfound is ignored') | self.log.info('Check that spurious notfound is ignored') | ||||
self.nodes[0].p2ps[0].send_message(msg_notfound(vec=[CInv(MSG_TX, 1)])) | self.nodes[0].p2ps[0].send_message(msg_notfound(vec=[CInv(MSG_TX, 1)])) | ||||
def run_test(self): | def run_test(self): | ||||
# Run each test against new bitcoind instances, as setting mocktimes has long-term effects on when | |||||
# the next trickle relay event happens. | |||||
for test in [self.test_spurious_notfound, self.test_in_flight_max, | |||||
self.test_inv_block, self.test_tx_requests]: | |||||
self.stop_nodes() | |||||
self.start_nodes() | |||||
self.connect_nodes(1, 0) | |||||
# Setup the p2p connections | # Setup the p2p connections | ||||
self.peers = [] | self.peers = [] | ||||
for node in self.nodes: | for node in self.nodes: | ||||
for i in range(NUM_INBOUND): | for _ in range(NUM_INBOUND): | ||||
self.peers.append(node.add_p2p_connection(TestP2PConn())) | self.peers.append(node.add_p2p_connection(TestP2PConn())) | ||||
self.log.info( | self.log.info( | ||||
"Nodes are setup with {} incoming connections each".format(NUM_INBOUND)) | "Nodes are setup with {} incoming connections each".format(NUM_INBOUND)) | ||||
test() | |||||
self.test_spurious_notfound() | |||||
# Test the in-flight max first, because we want no transactions in | |||||
# flight ahead of this test. | |||||
self.test_in_flight_max() | |||||
self.test_inv_block() | |||||
self.test_tx_requests() | |||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
TxDownloadTest().main() | TxDownloadTest().main() |