Example #1
0
    def _load_justified_head(self) -> None:
        encoded_epoch = self.db.get(
            SchemaV1.make_justified_head_epoch_lookup_key())
        if not encoded_epoch:
            self._highest_justified_epoch = GENESIS_EPOCH
            return

        self._highest_justified_epoch = ssz.decode(encoded_epoch, ssz.uint64)
Example #2
0
 def _update_justified_head(self, justified_root: Root,
                            epoch: Epoch) -> None:
     """
     Unconditionally write the ``justified_root`` as the root of the highest
     justified block.
     """
     self.db.set(SchemaV1.make_justified_head_root_lookup_key(),
                 justified_root)
     self.db.set(
         SchemaV1.make_justified_head_epoch_lookup_key(),
         ssz.encode(epoch, ssz.uint64),
     )