From 5f33b4164c5cd45255870901646ed4f3c63a8976 Mon Sep 17 00:00:00 2001 From: bonesoul Date: Fri, 3 Oct 2014 12:33:03 +0300 Subject: [PATCH] Fixed handling of default.json pool configuration. Fixed a bug with loading of pool json files with filenames starting with a,b,c and d. Moved a few more common values to default-example.json. --- .../Configuration/ConfigManager.cs | 19 +++++++++++-------- .../config/pools/default-example.json | 6 ++++++ src/CoiniumServ/config/pools/pool.json | 19 +------------------ 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/CoiniumServ/Configuration/ConfigManager.cs b/src/CoiniumServ/Configuration/ConfigManager.cs index 732d14976..3497bb53e 100644 --- a/src/CoiniumServ/Configuration/ConfigManager.cs +++ b/src/CoiniumServ/Configuration/ConfigManager.cs @@ -84,6 +84,7 @@ public ConfigManager(IConfigFactory configFactory, IJsonConfigReader jsonConfigR LoadGlobalConfig(); // read the global config. // LoadDaemonManagerConfig(); // load the global daemon manager config. - disabled until we need it. LoadSoftwareManagerConfig(); // load software manager config file. + LoadDefaultPoolConfig(); // load default pool config if exists. LoadPoolConfigs(); // load the per-pool config files. } @@ -120,6 +121,12 @@ private void LoadSoftwareManagerConfig() SoftwareRepositoryConfig = new SoftwareRepositoryConfig(_configFactory, data); } + private void LoadDefaultPoolConfig() + { + var data = _jsonConfigReader.Read(string.Format("{0}/default.json", PoolConfigRoot)); + _defaultPoolConfig = data ?? null; // set the default config data. + } + private void LoadPoolConfigs() { PoolConfigs = new List(); // list of pool configurations. @@ -127,19 +134,15 @@ private void LoadPoolConfigs() foreach (var file in files) { + var filename = Path.GetFileNameWithoutExtension(file); // read the filename. + if (!string.IsNullOrEmpty(filename) && filename.Equals("default", StringComparison.OrdinalIgnoreCase)) // if it's the default.json, + continue; // just skip it. + var data = _jsonConfigReader.Read(file); // read the pool config json. if (data == null) // make sure we have loaded json data. continue; - // check if we have a default.json pool config. - var filename = Path.GetFileNameWithoutExtension(file); - if (!string.IsNullOrEmpty(filename) && filename.Equals("default", StringComparison.OrdinalIgnoreCase)) - { - _defaultPoolConfig = data; - continue; // don't add the default.json to list of pools and yet again do not load the coinconfig data for it. - } - if (!data.enabled) // skip pools that are not enabled. continue; diff --git a/src/CoiniumServ/config/pools/default-example.json b/src/CoiniumServ/config/pools/default-example.json index d367f2a41..7b4147845 100644 --- a/src/CoiniumServ/config/pools/default-example.json +++ b/src/CoiniumServ/config/pools/default-example.json @@ -8,6 +8,7 @@ "txMessage": "http://www.coiniumserv.com/" }, "payments": { + "enabled": true, "interval": 60, "minimum": 0.01 }, @@ -20,9 +21,11 @@ "rebroadcastTimeout": 55 }, "stratum": { + "enabled": true, "bind": "0.0.0.0", "diff": 16, "vardiff": { + "enabled": true, "minDiff": 8, "maxDiff": 512, "targetTime": 15, @@ -31,6 +34,7 @@ } }, "banning": { + "enabled": true, "duration": 600, "invalidPercent": 50, "checkThreshold": 100, @@ -38,6 +42,7 @@ }, "storage": { "hybrid": { + "enabled": true, "redis": { "host": "127.0.0.1", "port": 6379, @@ -52,6 +57,7 @@ } }, "mpos": { + "enabled": false, "mysql": { "host": "127.0.0.1", "port": 3306, diff --git a/src/CoiniumServ/config/pools/pool.json b/src/CoiniumServ/config/pools/pool.json index 6929a029f..5c6be0258 100644 --- a/src/CoiniumServ/config/pools/pool.json +++ b/src/CoiniumServ/config/pools/pool.json @@ -14,28 +14,11 @@ "myxWybbhUkGzGF7yaf2QVNx3hh3HWTya5t": 1 } ], - "payments": { - "enabled": true - }, "stratum": { - "enabled": true, - "port": 3333, - "vardiff": { - "enabled": true - } - }, - "banning": { - "enabled": true + "port": 3333 }, "storage": { "hybrid": { - "enabled": false, - "mysql": { - "database": "db-name" - } - }, - "mpos": { - "enabled": false, "mysql": { "database": "db-name" }