def deserialize(cls, chain: list): """ Create a new Blockchain instance from the provided serialized chain. :param list chain: serialized chain of blocks. :return Blockchain: blockchain created from provided stringified chain. """ chain = list(map(lambda block: Block.deserialize(block), chain)) return cls(chain)
def test_block_deserialization(self): block = self.first_block.serialize() self.assertIsInstance(Block.deserialize(block), Block)