Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_tx_download.py
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | def test_in_flight_max(self): | ||||
WAIT_TIME = TX_EXPIRY_INTERVAL // 2 + TX_EXPIRY_INTERVAL | WAIT_TIME = TX_EXPIRY_INTERVAL // 2 + TX_EXPIRY_INTERVAL | ||||
self.log.info( | self.log.info( | ||||
"if we wait about {} minutes, we should eventually get more requests".format( | "if we wait about {} minutes, we should eventually get more requests".format( | ||||
WAIT_TIME / 60)) | WAIT_TIME / 60)) | ||||
self.nodes[0].setmocktime(int(time.time() + WAIT_TIME)) | self.nodes[0].setmocktime(int(time.time() + WAIT_TIME)) | ||||
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): | |||||
self.log.info('Check that spurious notfound is ignored') | |||||
self.nodes[0].p2ps[0].send_message(msg_notfound(vec=[CInv(1, 1)])) | |||||
def run_test(self): | def run_test(self): | ||||
# 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 i 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)) | ||||
self.test_spurious_notfound() | |||||
# Test the in-flight max first, because we want no transactions in | # Test the in-flight max first, because we want no transactions in | ||||
# flight ahead of this test. | # flight ahead of this test. | ||||
self.test_in_flight_max() | self.test_in_flight_max() | ||||
self.test_inv_block() | self.test_inv_block() | ||||
self.test_tx_requests() | self.test_tx_requests() | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
TxDownloadTest().main() | TxDownloadTest().main() |