async def handle_get_block_bodies(self, peer: ETHPeer, block_hashes: List[Hash32]) -> None: if not peer.is_operational: return self.logger.trace("%s requested bodies for %d blocks", peer, len(block_hashes)) chaindb = cast(AsyncChainDB, self.db) bodies = [] for block_hash in block_hashes: try: header = await self.wait(chaindb.coro_get_block_header_by_hash(block_hash)) except HeaderNotFound: self.logger.debug("%s asked for block we don't have: %s", peer, block_hash) continue transactions = await self.wait( chaindb.coro_get_block_transactions(header, BaseTransactionFields)) uncles = await self.wait(chaindb.coro_get_block_uncles(header.uncles_hash)) bodies.append(BlockBody(transactions, uncles)) self.logger.trace("Replying to %s with %d block bodies", peer, len(bodies)) peer.sub_proto.send_block_bodies(bodies)