Example #1
0
 private ProtocolSettings(IConfigurationSection section)
 {
     this.Magic                    = uint.Parse(section.GetSection("Magic").Value);
     this.AddressVersion           = byte.Parse(section.GetSection("AddressVersion").Value);
     this.StandbyValidators        = section.GetSection("StandbyValidators").GetChildren().Select(p => p.Value).ToArray();
     this.SeedList                 = section.GetSection("SeedList").GetChildren().Select(p => p.Value).ToArray();
     this.SecondsPerBlock          = GetValueOrDefault(section.GetSection("SecondsPerBlock"), 15u, p => uint.Parse(p));
     this.MaxSecondsPerBlock       = GetValueOrDefault(section.GetSection("MaxSecondsPerBlock"), 15u, p => uint.Parse(p));
     this.MaxTaskHashCount         = GetValueOrDefault(section.GetSection("MaxTaskHashCount"), 100000, p => int.Parse(p));
     this.MaxProtocolHashCount     = GetValueOrDefault(section.GetSection("MaxProtocolHashCount"), 100000, p => int.Parse(p));
     this.MemPoolRelayCount        = GetValueOrDefault(section.GetSection("MemPoolRelayCount"), 1000, p => int.Parse(p));
     this.NetworkType              = GetValueOrDefault(section.GetSection("NetworkType"), "Unknown", p => p);
     this.ListenMessages           = section.GetSection("ListenMessages").GetChildren().Select(p => p.Value).ToList();
     this.EnableRawTxnMsg          = GetValueOrDefault(section.GetSection("EnableRawTxnMsg"), true, p => bool.Parse(p));
     this.EnableCompressedRawTxn   = GetValueOrDefault(section.GetSection("EnableCompressedRawTxn"), true, p => bool.Parse(p));
     this.GasPriceLowestThreshold  = GetValueOrDefault(section.GetSection("GasPriceLowestThreshold"), Fixed8.FromDecimal(0.00001m), p => Fixed8.Parse(p));
     this.GasPriceHighestThreshold = GetValueOrDefault(section.GetSection("GasPriceHighestThreshold"), Fixed8.FromDecimal(100), p => Fixed8.Parse(p));
 }
Example #2
0
 public Settings(IConfigurationSection section)
 {
     this.Magic             = uint.Parse(section.GetSection("Magic").Value);
     this.AddressVersion    = byte.Parse(section.GetSection("AddressVersion").Value);
     this.StandbyValidators = section.GetSection("StandbyValidators").GetChildren().Select(p => p.Value).ToArray();
     this.SeedList          = section.GetSection("SeedList").GetChildren().Select(p => p.Value).ToArray();
     this.SystemFee         = section.GetSection("SystemFee").GetChildren().ToDictionary(p => (TransactionType)Enum.Parse(typeof(TransactionType), p.Key, true), p => Fixed8.Parse(p.Value));
     this.SecondsPerBlock   = GetValueOrDefault(section.GetSection("SecondsPerBlock"), 15u, p => uint.Parse(p));
     this.AppChains         = new AppChainsSettings(section.GetSection("AppChains"));
 }