mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
config: improve pool section writing.
Order so JSON's not broken, write `priority` and `algorithm`. Closes #102.
This commit is contained in:
parent
e42f77d9c1
commit
3d7167ce2c
23
sgminer.c
23
sgminer.c
@ -4274,13 +4274,6 @@ void write_config(FILE *fcfg)
|
||||
for(i = 0; i < total_pools; i++) {
|
||||
struct pool *pool = pools[i];
|
||||
|
||||
/* Using get_pool_name() here is unsafe if opt_incognito is true. */
|
||||
if (strcmp(pool->name, "") != 0) {
|
||||
fprintf(fcfg, "\n\t\t\"name\" : \"%s\",", json_escape(pool->name));
|
||||
}
|
||||
if (strcmp(pool->description, "") != 0) {
|
||||
fprintf(fcfg, "\n\t\t\"description\" : \"%s\",", json_escape(pool->description));
|
||||
}
|
||||
if (pool->quota != 1) {
|
||||
fprintf(fcfg, "%s\n\t{\n\t\t\"quota\" : \"%s%s%s%d;%s\",", i > 0 ? "," : "",
|
||||
pool->rpc_proxy ? json_escape((char *)proxytype(pool->rpc_proxytype)) : "",
|
||||
@ -4296,8 +4289,22 @@ void write_config(FILE *fcfg)
|
||||
json_escape(pool->rpc_url));
|
||||
}
|
||||
fprintf(fcfg, "\n\t\t\"user\" : \"%s\",", json_escape(pool->rpc_user));
|
||||
fprintf(fcfg, "\n\t\t\"pass\" : \"%s\"\n\t}", json_escape(pool->rpc_pass));
|
||||
fprintf(fcfg, "\n\t\t\"pass\" : \"%s\",", json_escape(pool->rpc_pass));
|
||||
/* Using get_pool_name() here is unsafe if opt_incognito is true. */
|
||||
if (strcmp(pool->name, "") != 0) {
|
||||
fprintf(fcfg, "\n\t\t\"name\" : \"%s\",", json_escape(pool->name));
|
||||
}
|
||||
if (strcmp(pool->description, "") != 0) {
|
||||
fprintf(fcfg, "\n\t\t\"description\" : \"%s\",", json_escape(pool->description));
|
||||
}
|
||||
if (!cmp_algorithm(&pool->algorithm, opt_algorithm)) {
|
||||
fprintf(fcfg, "\n\t\t\"algorithm\" : \"%s\",", json_escape(pool->algorithm.name));
|
||||
}
|
||||
if (pool->prio != i) {
|
||||
fprintf(fcfg, "\n\t\t\"priority\" : \"%d\"", pool->prio);
|
||||
}
|
||||
fprintf(fcfg, "\n\t}");
|
||||
}
|
||||
fputs("\n]\n", fcfg);
|
||||
|
||||
/* Write only if there are usable GPUs */
|
||||
|
Loading…
x
Reference in New Issue
Block a user