diff --git a/blocknotify/blocknotify.cpp b/blocknotify/blocknotify.cpp index cb63959..f96d2b3 100644 --- a/blocknotify/blocknotify.cpp +++ b/blocknotify/blocknotify.cpp @@ -76,15 +76,10 @@ int main(int argc, char **argv) send(sock, buffer, strlen(buffer), 0); close(sock); + //fprintf(stdout, "notify %s\n", buffer); + return 0; } - - - - - - - diff --git a/stratum/client.cpp b/stratum/client.cpp index fd5bd03..5411863 100644 --- a/stratum/client.cpp +++ b/stratum/client.cpp @@ -266,15 +266,16 @@ bool client_update_block(YAAMP_CLIENT *client, json_value *json_params) YAAMP_COIND *coind = (YAAMP_COIND *)object_find(&g_list_coind, json_params->u.array.values[1]->u.integer, true); if(!coind) return false; + const char* hash = json_params->u.array.values[2]->u.string.ptr; + #ifdef CLIENT_DEBUGLOG_ - debuglog("new block for %s ", coind->name); - debuglog("%s\n", json_params->u.array.values[2]->u.string.ptr); + debuglog("notify: new %s block %s\n", coind->symbol, hash); #endif coind->newblock = true; coind->notreportingcounter = 0; - block_confirm(coind->id, json_params->u.array.values[2]->u.string.ptr); + block_confirm(coind->id, hash); coind_create_job(coind); object_unlock(coind); diff --git a/stratum/client_submit.cpp b/stratum/client_submit.cpp index d4d3846..8d70dab 100644 --- a/stratum/client_submit.cpp +++ b/stratum/client_submit.cpp @@ -227,7 +227,9 @@ void client_do_submit(YAAMP_CLIENT *client, YAAMP_JOB *job, YAAMP_JOB_VALUES *su bool b = coind_submit(coind, block_hex); if(b) { - debuglog("*** ACCEPTED %s %d\n", coind->name, templ->height); + debuglog("*** ACCEPTED %s %d (diff %g) by %s (id: %d)\n", coind->name, templ->height, + target_to_diff(hash_int), client->sock->ip, client->userid); + job->block_found = true; char doublehash2[128]; diff --git a/stratum/rpc_curl.cpp b/stratum/rpc_curl.cpp index 378dc42..44f5e14 100644 --- a/stratum/rpc_curl.cpp +++ b/stratum/rpc_curl.cpp @@ -199,7 +199,7 @@ static int sockopt_keepalive_cb(void *userdata, curl_socket_t fd, static json_value *curl_json_rpc(YAAMP_RPC *rpc, const char *url, const char *rpc_req, int *curl_err) { - char len_hdr[64], auth_hdr[64]; + char len_hdr[64] = { 0 }, auth_hdr[512] = { 0 }; char curl_err_str[CURL_ERROR_SIZE] = { 0 }; struct data_buffer all_data = { 0 }; struct upload_buffer upload_data; @@ -248,13 +248,8 @@ static json_value *curl_json_rpc(YAAMP_RPC *rpc, const char *url, const char *rp curl_easy_setopt(curl, CURLOPT_PROXYTYPE, opt_proxy_type); } -#if 0 - curl_easy_setopt(curl, CURLOPT_USERPWD, rpc->credential); - curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); -#else // Encoded login/pass - sprintf(auth_hdr, "Authorization: Basic %s", rpc->credential); -#endif + snprintf(auth_hdr, sizeof(auth_hdr), "Authorization: Basic %s", rpc->credential); #if LIBCURL_VERSION_NUM >= 0x070f06 if (keepalive) @@ -443,4 +438,4 @@ json_value *rpc_curl_call(YAAMP_RPC *rpc, char const *method, char const *params return json; } -#endif /* HAVE_CURL */ \ No newline at end of file +#endif /* HAVE_CURL */ diff --git a/stratum/share.cpp b/stratum/share.cpp index 35496f9..fa921d9 100644 --- a/stratum/share.cpp +++ b/stratum/share.cpp @@ -175,7 +175,11 @@ void block_prune(YAAMP_DB *db) YAAMP_BLOCK *block = (YAAMP_BLOCK *)li->data; if(!block->confirmed) { - if(block->created + 30 < time(NULL)) + int elapsed = 30; + // slow block time... + if(g_stratum_algo && !strcmp(g_stratum_algo, "decred")) elapsed = 60 * 15; // 15mn + + if((block->created + elapsed) < time(NULL)) object_delete(block); continue;