public NodeSettings(Arguments settings, DataNode section) { this.WebLogs = settings.GetBool("web.log", section.GetBool("web.logs")); this.BlockTime = settings.GetInt("block.time", section.GetInt32("block.time")); this.MinimumFee = settings.GetInt("minimum.fee", section.GetInt32("minimum.fee")); this.MinimumPow = settings.GetInt("minimum.pow", section.GetInt32("minimum.pow")); int maxPow = 5; // should be a constanct like MinimumBlockTime if (this.MinimumPow < 0 || this.MinimumPow > maxPow) { throw new Exception("Proof-Of-Work difficulty has to be between 1 and 5"); } this.ApiProxyUrl = settings.GetString("api.proxy.url", section.GetString("api.proxy.url")); if (string.IsNullOrEmpty(this.ApiProxyUrl)) { this.ApiProxyUrl = null; } this.Seeds = section.GetNode("seeds").Children.Select(p => p.Value).ToList(); this.Mode = settings.GetEnum <NodeMode>("node.mode", section.GetEnum <NodeMode>("node.mode", NodeMode.Invalid)); if (this.Mode == NodeMode.Invalid) { throw new Exception("Unknown node mode specified"); } this.NexusName = settings.GetString("nexus.name", section.GetString("nexus.name")); this.NodeWif = settings.GetString("node.wif", section.GetString("node.wif")); this.StorageConversion = settings.GetBool("convert.storage", section.GetBool("convert.storage")); this.ApiLog = settings.GetBool("api.log", section.GetBool("api.log")); this.NodePort = settings.GetInt("node.port", section.GetInt32("node.port")); this.NodeHost = settings.GetString("node.host", section.GetString("node.host", "localhost")); this.ProfilerPath = settings.GetString("profiler.path", section.GetString("profiler.path")); if (string.IsNullOrEmpty(this.ProfilerPath)) { this.ProfilerPath = null; } this.HasSync = settings.GetBool("has.sync", section.GetBool("has.sync")); this.HasMempool = settings.GetBool("has.mempool", section.GetBool("has.mempool")); this.MempoolLog = settings.GetBool("mempool.log", section.GetBool("mempool.log")); this.HasEvents = settings.GetBool("has.events", section.GetBool("has.events")); this.HasRelay = settings.GetBool("has.relay", section.GetBool("has.relay")); this.HasArchive = settings.GetBool("has.archive", section.GetBool("has.archive")); this.HasRpc = settings.GetBool("has.rpc", section.GetBool("has.rpc")); this.RpcPort = settings.GetInt("rpc.port", section.GetInt32("rpc.port")); this.HasRest = settings.GetBool("has.rest", section.GetBool("has.rest")); this.RestPort = settings.GetInt("rest.port", section.GetInt32("rest.port")); this.NexusBootstrap = settings.GetBool("nexus.bootstrap", section.GetBool("nexus.bootstrap")); this.GenesisTimestampUint = settings.GetUInt("genesis.timestamp", section.GetUInt32("genesis.timestamp")); this.GenesisTimestamp = new Timestamp((this.GenesisTimestampUint == 0) ? Timestamp.Now.Value : this.GenesisTimestampUint); this.ApiCache = settings.GetBool("api.cache", section.GetBool("api.cache")); this.Readonly = settings.GetBool("readonly", section.GetBool("readonly")); this.SenderHost = settings.GetString("sender.host", section.GetString("sender.host")); this.SenderThreads = settings.GetUInt("sender.threads", section.GetUInt32("sender.threads")); this.SenderAddressCount = settings.GetUInt("sender.address.count", section.GetUInt32("sender.address.count")); var defaultStoragePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/Storage/"; var defaultOraclePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/Oracle/"; this.StoragePath = settings.GetString("storage.path", section.GetString("storage.path")); if (string.IsNullOrEmpty(this.StoragePath)) { this.StoragePath = defaultStoragePath; } if (!StoragePath.EndsWith("" + Path.DirectorySeparatorChar)) { StoragePath += Path.DirectorySeparatorChar; } StoragePath = Path.GetFullPath(StoragePath); this.VerifyStoragePath = settings.GetString("verify.storage.path", section.GetString("verify.storage.path")); if (string.IsNullOrEmpty(this.VerifyStoragePath)) { this.VerifyStoragePath = defaultStoragePath; } this.OraclePath = settings.GetString("oracle.path", section.GetString("oracle.path")); if (string.IsNullOrEmpty(this.OraclePath)) { this.OraclePath = defaultOraclePath; } var backend = settings.GetString("storage.backend", section.GetString("storage.backend")); if (!Enum.TryParse <StorageBackendType>(backend, true, out this.StorageBackend)) { throw new Exception("Unknown storage backend: " + backend); } if (this.StorageConversion) { this.RandomSwapData = section.GetBool("random.Swap.data"); } }