def from_header(cls, header: BlockHeaderAPI, chaindb: ChainDatabaseAPI) -> "FrontierBlock": """ Returns the block denoted by the given block header. :raise eth.exceptions.BlockNotFound: if transactions or uncle headers are missing """ if header.uncles_hash == EMPTY_UNCLE_HASH: uncles: Tuple[BlockHeader, ...] = () else: try: uncles = chaindb.get_block_uncles(header.uncles_hash) except HeaderNotFound as exc: raise BlockNotFound( f"Uncles not found in database for {header}: {exc}" ) from exc try: transactions = chaindb.get_block_transactions( header, cls.get_transaction_class()) except MissingTrieNode as exc: raise BlockNotFound( f"Transactions not found in database for {header}: {exc}" ) from exc return cls( header=header, transactions=transactions, uncles=uncles, )
def from_header(cls, header: BlockHeaderAPI, chaindb: ChainDatabaseAPI) -> "FrontierBlock": """ Returns the block denoted by the given block header. """ if header.uncles_hash == EMPTY_UNCLE_HASH: uncles: Tuple[BlockHeader, ...] = () else: uncles = chaindb.get_block_uncles(header.uncles_hash) transactions = chaindb.get_block_transactions(header, cls.get_transaction_class()) return cls( header=header, transactions=transactions, uncles=uncles, )