Skip to content

Commit

Permalink
stratum: increase decred blocks purge time
Browse files Browse the repository at this point in the history
show some user diff and finder id on block accept

curl: increase the credentials field size to allow very long passwords
  • Loading branch information
tpruvot committed Feb 23, 2016
1 parent 4d23f95 commit 5460cb2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 20 deletions.
9 changes: 2 additions & 7 deletions blocknotify/blocknotify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}










7 changes: 4 additions & 3 deletions stratum/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion stratum/client_submit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
11 changes: 3 additions & 8 deletions stratum/rpc_curl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -443,4 +438,4 @@ json_value *rpc_curl_call(YAAMP_RPC *rpc, char const *method, char const *params
return json;
}

#endif /* HAVE_CURL */
#endif /* HAVE_CURL */
6 changes: 5 additions & 1 deletion stratum/share.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5460cb2

Please sign in to comment.