def test_extract_channel_config(self): with open(self.channel_tx, 'rb') as f: channel_tx = f.read() config_update = configtx_pb2.ConfigUpdate() channel_config = utils.extract_channel_config(channel_tx) self.assertTrue(hasattr(channel_config, 'decode')) config_update.ParseFromString(channel_config) self.assertEqual(config_update.channel_id, self.channel_id)
def decode_config_update(config_update_bytes): """Decodes update bytes in configuration :param config_update_bytes: Bytes :type config_update_bytes: str :return: deserialized configuration update """ config_update = {} proto_config_update = configtx_pb2.ConfigUpdate() proto_config_update.ParseFromString(config_update_bytes) config_update['channel_id'] = proto_config_update.channel_id config_update['read_set'] = \ decode_config_group(proto_config_update.read_set) config_update['write_set'] = \ decode_config_group(proto_config_update.write_set) # config_update['type'] = proto_config_update TODO: getType() equivalent return config_update