async def get_lca(self) -> Optional[Header]: cursor = await self.db.execute( "SELECT header from headers WHERE is_lca=1") row = await cursor.fetchone() await cursor.close() if row is not None: return Header.from_bytes(row[0]) return None
async def get_headers(self) -> Dict[bytes32, Header]: cursor = await self.db.execute( "SELECT header_hash, header from headers") rows = await cursor.fetchall() await cursor.close() return { bytes.fromhex(row[0]): Header.from_bytes(row[1]) for row in rows }
async def get_tips(self) -> List[bytes32]: cursor = await self.db.execute( "SELECT header from headers WHERE is_tip=1") rows = await cursor.fetchall() await cursor.close() return [Header.from_bytes(row[0]) for row in rows]
async def get_headers(self) -> List[Header]: cursor = await self.db.execute("SELECT * from headers") rows = await cursor.fetchall() await cursor.close() return [Header.from_bytes(row[3]) for row in rows]