Skip to content

Commit 3d64714

Browse files
author
Hüseyin Uslu
committed
Merge pull request #526 from CoiniumServ/develop
Hotfix for v0.2.0 - default.json handling
2 parents 2e67838 + 77d7764 commit 3d64714

File tree

3 files changed

+18
-26
lines changed

3 files changed

+18
-26
lines changed

src/CoiniumServ/Configuration/ConfigManager.cs

+11-8
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public ConfigManager(IConfigFactory configFactory, IJsonConfigReader jsonConfigR
8484
LoadGlobalConfig(); // read the global config.
8585
// LoadDaemonManagerConfig(); // load the global daemon manager config. - disabled until we need it.
8686
LoadSoftwareManagerConfig(); // load software manager config file.
87+
LoadDefaultPoolConfig(); // load default pool config if exists.
8788
LoadPoolConfigs(); // load the per-pool config files.
8889
}
8990

@@ -120,26 +121,28 @@ private void LoadSoftwareManagerConfig()
120121
SoftwareRepositoryConfig = new SoftwareRepositoryConfig(_configFactory, data);
121122
}
122123

124+
private void LoadDefaultPoolConfig()
125+
{
126+
var data = _jsonConfigReader.Read(string.Format("{0}/default.json", PoolConfigRoot));
127+
_defaultPoolConfig = data ?? null; // set the default config data.
128+
}
129+
123130
private void LoadPoolConfigs()
124131
{
125132
PoolConfigs = new List<IPoolConfig>(); // list of pool configurations.
126133
var files = FileHelpers.GetFilesByExtension(PoolConfigRoot, ".json");
127134

128135
foreach (var file in files)
129136
{
137+
var filename = Path.GetFileNameWithoutExtension(file); // read the filename.
138+
if (!string.IsNullOrEmpty(filename) && filename.Equals("default", StringComparison.OrdinalIgnoreCase)) // if it's the default.json,
139+
continue; // just skip it.
140+
130141
var data = _jsonConfigReader.Read(file); // read the pool config json.
131142

132143
if (data == null) // make sure we have loaded json data.
133144
continue;
134145

135-
// check if we have a default.json pool config.
136-
var filename = Path.GetFileNameWithoutExtension(file);
137-
if (!string.IsNullOrEmpty(filename) && filename.Equals("default", StringComparison.OrdinalIgnoreCase))
138-
{
139-
_defaultPoolConfig = data;
140-
continue; // don't add the default.json to list of pools and yet again do not load the coinconfig data for it.
141-
}
142-
143146
if (!data.enabled) // skip pools that are not enabled.
144147
continue;
145148

src/CoiniumServ/config/pools/default-example.json

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"txMessage": "http://www.coiniumserv.com/"
99
},
1010
"payments": {
11+
"enabled": true,
1112
"interval": 60,
1213
"minimum": 0.01
1314
},
@@ -20,9 +21,11 @@
2021
"rebroadcastTimeout": 55
2122
},
2223
"stratum": {
24+
"enabled": true,
2325
"bind": "0.0.0.0",
2426
"diff": 16,
2527
"vardiff": {
28+
"enabled": true,
2629
"minDiff": 8,
2730
"maxDiff": 512,
2831
"targetTime": 15,
@@ -31,13 +34,15 @@
3134
}
3235
},
3336
"banning": {
37+
"enabled": true,
3438
"duration": 600,
3539
"invalidPercent": 50,
3640
"checkThreshold": 100,
3741
"purgeInterval": 300
3842
},
3943
"storage": {
4044
"hybrid": {
45+
"enabled": true,
4146
"redis": {
4247
"host": "127.0.0.1",
4348
"port": 6379,
@@ -52,6 +57,7 @@
5257
}
5358
},
5459
"mpos": {
60+
"enabled": false,
5561
"mysql": {
5662
"host": "127.0.0.1",
5763
"port": 3306,

src/CoiniumServ/config/pools/pool.json

+1-18
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,11 @@
1414
"myxWybbhUkGzGF7yaf2QVNx3hh3HWTya5t": 1
1515
}
1616
],
17-
"payments": {
18-
"enabled": true
19-
},
2017
"stratum": {
21-
"enabled": true,
22-
"port": 3333,
23-
"vardiff": {
24-
"enabled": true
25-
}
26-
},
27-
"banning": {
28-
"enabled": true
18+
"port": 3333
2919
},
3020
"storage": {
3121
"hybrid": {
32-
"enabled": false,
33-
"mysql": {
34-
"database": "db-name"
35-
}
36-
},
37-
"mpos": {
38-
"enabled": false,
3922
"mysql": {
4023
"database": "db-name"
4124
}

0 commit comments

Comments
 (0)