mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 09:27:25 +00:00
stratum: increase decred blocks purge time
show some user diff and finder id on block accept curl: increase the credentials field size to allow very long passwords
This commit is contained in:
parent
4d23f95d04
commit
5460cb205d
5 changed files with 17 additions and 20 deletions
|
@ -76,15 +76,10 @@ int main(int argc, char **argv)
|
||||||
send(sock, buffer, strlen(buffer), 0);
|
send(sock, buffer, strlen(buffer), 0);
|
||||||
close(sock);
|
close(sock);
|
||||||
|
|
||||||
|
//fprintf(stdout, "notify %s\n", buffer);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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);
|
YAAMP_COIND *coind = (YAAMP_COIND *)object_find(&g_list_coind, json_params->u.array.values[1]->u.integer, true);
|
||||||
if(!coind) return false;
|
if(!coind) return false;
|
||||||
|
|
||||||
|
const char* hash = json_params->u.array.values[2]->u.string.ptr;
|
||||||
|
|
||||||
#ifdef CLIENT_DEBUGLOG_
|
#ifdef CLIENT_DEBUGLOG_
|
||||||
debuglog("new block for %s ", coind->name);
|
debuglog("notify: new %s block %s\n", coind->symbol, hash);
|
||||||
debuglog("%s\n", json_params->u.array.values[2]->u.string.ptr);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
coind->newblock = true;
|
coind->newblock = true;
|
||||||
coind->notreportingcounter = 0;
|
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);
|
coind_create_job(coind);
|
||||||
object_unlock(coind);
|
object_unlock(coind);
|
||||||
|
|
|
@ -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);
|
bool b = coind_submit(coind, block_hex);
|
||||||
if(b)
|
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;
|
job->block_found = true;
|
||||||
|
|
||||||
char doublehash2[128];
|
char doublehash2[128];
|
||||||
|
|
|
@ -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)
|
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 };
|
char curl_err_str[CURL_ERROR_SIZE] = { 0 };
|
||||||
struct data_buffer all_data = { 0 };
|
struct data_buffer all_data = { 0 };
|
||||||
struct upload_buffer upload_data;
|
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);
|
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
|
// Encoded login/pass
|
||||||
sprintf(auth_hdr, "Authorization: Basic %s", rpc->credential);
|
snprintf(auth_hdr, sizeof(auth_hdr), "Authorization: Basic %s", rpc->credential);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if LIBCURL_VERSION_NUM >= 0x070f06
|
#if LIBCURL_VERSION_NUM >= 0x070f06
|
||||||
if (keepalive)
|
if (keepalive)
|
||||||
|
@ -443,4 +438,4 @@ json_value *rpc_curl_call(YAAMP_RPC *rpc, char const *method, char const *params
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_CURL */
|
#endif /* HAVE_CURL */
|
||||||
|
|
|
@ -175,7 +175,11 @@ void block_prune(YAAMP_DB *db)
|
||||||
YAAMP_BLOCK *block = (YAAMP_BLOCK *)li->data;
|
YAAMP_BLOCK *block = (YAAMP_BLOCK *)li->data;
|
||||||
if(!block->confirmed)
|
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);
|
object_delete(block);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Reference in a new issue