Пример #1
0
 def get_canonical_head(self) -> BlockHeader:
     """
     Returns the current block header at the head of the chain.
     """
     try:
         canonical_head_hash = self.db[SchemaV1.make_canonical_head_hash_lookup_key()]
     except KeyError:
         raise CanonicalHeadNotFound("No canonical head set for this chain")
     return self.get_block_header_by_hash(canonical_head_hash)
Пример #2
0
 def get_canonical_head(self):
     if not self.exists(CANONICAL_HEAD_HASH_DB_KEY):
         raise CanonicalHeadNotFound("No canonical head set for this chain")
     return self.get_block_header_by_hash(self.db.get(CANONICAL_HEAD_HASH_DB_KEY))