diff --git a/src/bitcoin.c b/src/bitcoin.c index 8639c848..644c6b24 100644 --- a/src/bitcoin.c +++ b/src/bitcoin.c @@ -123,6 +123,7 @@ static bool gbt_merkle_bins(gbtbase_t *gbt, json_t *transaction_arr) memcpy(gbt->txn_data + ofs, txn, len); ofs += len; #if 0 + /* In case we ever want to be a gbt poolproxy */ if (!hash) { char *txn_bin; int txn_len; diff --git a/src/ckpool.c b/src/ckpool.c index 04cacba7..3d8ce53c 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -166,7 +166,7 @@ static void json_get_string(char **store, json_t *val, const char *res) const char *buf; *store = NULL; - if (json_is_null(entry)) { + if (!entry || json_is_null(entry)) { LOGDEBUG("Json did not find entry %s", res); return; } @@ -193,6 +193,8 @@ static void parse_config(ckpool_t *ckp) json_get_string(&ckp->btcdurl, json_conf, "btcdurl"); json_get_string(&ckp->btcdauth, json_conf, "btcdauth"); json_get_string(&ckp->btcdpass, json_conf, "btcdpass"); + json_get_string(&ckp->btcaddress, json_conf, "btcaddress"); + json_get_string(&ckp->btcsig, json_conf, "btcsig"); json_decref(json_conf); } @@ -223,8 +225,8 @@ int main(int argc, char **argv) { struct sigaction handler; pthread_t pth_listener; + int len, c, ret; ckpool_t ckp; - int c, ret; global_ckp = &ckp; memset(&ckp, 0, sizeof(ckp)); @@ -247,12 +249,17 @@ int main(int argc, char **argv) if (!ckp.name) ckp.name = strdup("ckpool"); - if (!ckp.config) - ckp.config = strdup("ckpool.conf"); - if (!ckp.socket_dir) - ckp.socket_dir = strdup("/tmp/ckpool"); - - realloc_strcat(&ckp.socket_dir, "/"); + if (!ckp.config) { + ckp.config = strdup(ckp.name); + realloc_strcat(&ckp.config, ".conf"); + } + if (!ckp.socket_dir) { + ckp.socket_dir = strdup("/tmp/"); + realloc_strcat(&ckp.socket_dir, ckp.name); + } + len = strlen(ckp.socket_dir); + if (memcmp(&ckp.socket_dir[len], "/", 1)) + realloc_strcat(&ckp.socket_dir, "/"); /* Ignore sigpipe */ signal(SIGPIPE, SIG_IGN); diff --git a/src/libckpool.h b/src/libckpool.h index d19e5ee9..9b9eb058 100644 --- a/src/libckpool.h +++ b/src/libckpool.h @@ -154,6 +154,8 @@ struct ckpool_instance { char *btcdurl; char *btcdauth; char *btcdpass; + char *btcaddress; + char *btcsig; }; void create_pthread(pthread_t *thread, void *(*start_routine)(void *), void *arg);