def _get_head_state_root(db: DatabaseAPI) -> Hash32: try: head_state_root = db[SchemaV1.make_head_state_root_lookup_key()] except KeyError: raise HeadStateSlotNotFound("No head state slot found") return Hash32(head_state_root)
def _add_head_state_root_lookup(self, root: Hash32) -> None: """ Write head state root into the database. """ self.db.set(SchemaV1.make_head_state_root_lookup_key(), root)