Ejemplo n.º 1
0
 def get_block_signature_by_root(self, block_root: Root) -> BLSSignature:
     """
     ``block_root`` is the hash tree root of a beacon block.
     This method provides a way to reconstruct the ``SignedBeaconBlock`` if required.
     """
     key = SchemaV1.block_root_to_signature(block_root)
     try:
         return BLSSignature(self.db[key])
     except KeyError:
         raise BlockNotFound()
Ejemplo n.º 2
0
    def persist_block(self, signed_block: BaseSignedBeaconBlock) -> None:
        block = signed_block.message
        block_root = block.hash_tree_root

        block_root_to_block = SchemaV1.block_root_to_block(block_root)
        self.db[block_root_to_block] = ssz.encode(block)

        signature = signed_block.signature
        block_root_to_signature = SchemaV1.block_root_to_signature(block_root)
        self.db[block_root_to_signature] = signature