示例#1
0
 def _add_head_state_slot_lookup(self, slot: Slot) -> None:
     """
     Write head state slot into the database.
     """
     self.db.set(
         SchemaV1.make_head_state_slot_lookup_key(),
         ssz.encode(slot, sedes=ssz.sedes.uint64),
     )
示例#2
0
 def _get_head_state_slot(db: DatabaseAPI) -> Slot:
     try:
         encoded_head_state_slot = db[
             SchemaV1.make_head_state_slot_lookup_key()]
         head_state_slot = ssz.decode(encoded_head_state_slot,
                                      sedes=ssz.sedes.uint64)
     except KeyError:
         raise HeadStateSlotNotFound("No head state slot found")
     return head_state_slot