Esempio n. 1
0
        private Protos.Common.CollectionConfigPackage Parse(JArray jsonConfig)
        {
            Protos.Common.CollectionConfigPackage ls = new Protos.Common.CollectionConfigPackage();
            foreach (JToken j in jsonConfig)
            {
                JObject scf = j["StaticCollectionConfig"] as JObject;
                if (scf == null)
                {
                    throw new ChaincodeCollectionConfigurationException($"Expected StaticCollectionConfig to be Object type but got: {j.Type.ToString()}");
                }
                StaticCollectionConfig ssc = new StaticCollectionConfig();
                ssc.Name             = scf["name"].Value <string>();
                ssc.BlockToLive      = scf["blockToLive"].Value <ulong>();
                ssc.MaximumPeerCount = scf["maximumPeerCount"].Value <int>();
                CollectionPolicyConfig cpc = new CollectionPolicyConfig();
                cpc.SignaturePolicy   = ParseSignaturePolicyEnvelope(scf);
                ssc.MemberOrgsPolicy  = cpc;
                ssc.RequiredPeerCount = scf["requiredPeerCount"].Value <int>();
                Protos.Common.CollectionConfig cf = new Protos.Common.CollectionConfig();
                cf.StaticCollectionConfig = ssc;
                ls.Config.Add(cf);
            }

            return(ls);
        }
 public CollectionConfig(Protos.Common.CollectionConfig cConfig)
 {
     collectionConfig          = cConfig;
     getStaticCollectionConfig = collectionConfig.StaticCollectionConfig;
 }