Merge pull request #25 from LBRYFoundation/roylee17/update-pool-signature-in-coinbase

Roylee17/update pool signature in coinbase
This commit is contained in:
Ralph 2022-11-17 11:51:49 -05:00 committed by GitHub
commit b0cb82cb0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 11 deletions

View file

@ -304,9 +304,15 @@ bool client_update_block(YAAMP_CLIENT *client, json_value *json_params)
} }
int coinid = json_params->u.array.values[1]->u.integer; int coinid = json_params->u.array.values[1]->u.integer;
if(!coinid) return false; if(!coinid) {
debuglog("client_update_block(): object_find() coin id failed\n");
return false;
}
YAAMP_COIND *coind = (YAAMP_COIND *)object_find(&g_list_coind, coinid, true); YAAMP_COIND *coind = (YAAMP_COIND *)object_find(&g_list_coind, coinid, true);
if(!coind) return false; if(!coind) {
debuglog("client_update_block(): can't find coind for coinid:%d\n", coinid);
return false;
}
const char* hash = json_params->u.array.values[2]->u.string.ptr; const char* hash = json_params->u.array.values[2]->u.string.ptr;
@ -319,7 +325,8 @@ bool client_update_block(YAAMP_CLIENT *client, json_value *json_params)
coind->newblock = true; coind->newblock = true;
coind->notreportingcounter = 0; coind->notreportingcounter = 0;
if (!strcmp("DCR", coind->rpcencoding)) { if (!strcmp("DCR", coind->rpcencoding) || !strcmp("LBC", coind->rpcencoding))
{
usleep(300 * YAAMP_MS); usleep(300 * YAAMP_MS);
} }

View file

@ -281,8 +281,8 @@ static void client_do_submit(YAAMP_CLIENT *client, YAAMP_JOB *job, YAAMP_JOB_VAL
target_to_diff(coin_target), target_to_diff(hash_int), target_to_diff(coin_target), target_to_diff(hash_int),
hash1, submitvalues->hash_be, templ->has_segwit_txs); hash1, submitvalues->hash_be, templ->has_segwit_txs);
if(!strcmp("DCR", coind->rpcencoding)) { if(!strcmp("DCR", coind->rpcencoding) ||!strcmp("LBC", coind->rpcencoding)) {
// delay between dcrd and dcrwallet // delay between dcrd/lbcd and dcrwallet/lbcwallet
sleep(1); sleep(1);
} }

View file

@ -97,7 +97,7 @@ void coinbase_create(YAAMP_COIND *coind, YAAMP_JOB_TEMPLATE *templ, json_value *
char script1[4*1024]; char script1[4*1024];
sprintf(script1, "%s%s%s08", eheight, templ->flags, etime); sprintf(script1, "%s%s%s08", eheight, templ->flags, etime);
char script2[32] = "7969696d7000"; // "yiimp\0" in hex ascii char script2[32] = "2f6c627279706f6f6c2e6e65742f"; // "/lbrypool.net/" in hex ascii
if(!coind->pos && !coind->isaux && templ->auxs_size) if(!coind->pos && !coind->isaux && templ->auxs_size)
coinbase_aux(templ, script2); coinbase_aux(templ, script2);

View file

@ -239,8 +239,8 @@ YAAMP_JOB_TEMPLATE *coind_create_template(YAAMP_COIND *coind)
json_value *json = rpc_call(&coind->rpc, "getblocktemplate", params); json_value *json = rpc_call(&coind->rpc, "getblocktemplate", params);
if(!json || json_is_null(json)) if(!json || json_is_null(json))
{ {
// coind_error() reset auto_ready, and DCR gbt can fail // coind_error() reset auto_ready, and DCR/LBC gbt can fail
if (strcmp(coind->rpcencoding, "DCR") == 0) if (!strcmp(coind->rpcencoding, "DCR") || !strcmp(coind->rpcencoding, "LBC"))
debuglog("decred getblocktemplate failed\n"); debuglog("decred getblocktemplate failed\n");
else else
coind_error(coind, "getblocktemplate"); coind_error(coind, "getblocktemplate");
@ -523,10 +523,12 @@ bool coind_create_job(YAAMP_COIND *coind, bool force)
if(!templ) if(!templ)
{ {
CommonUnlock(&coind->mutex); CommonUnlock(&coind->mutex);
// debuglog("%s: create job template failed!\n", coind->symbol); stratumlog("%s: create job template failed!\n", coind->symbol);
return false; return false;
} }
stratumlog("templ->height: %d, coind->height: %d\n", templ->height, coind->height);
YAAMP_JOB *job_last = coind->job; YAAMP_JOB *job_last = coind->job;
if( !force && job_last && job_last->templ && job_last->templ->created + 45 > time(NULL) && if( !force && job_last && job_last->templ && job_last->templ->created + 45 > time(NULL) &&
@ -592,7 +594,7 @@ bool coind_create_job(YAAMP_COIND *coind, bool force)
g_list_job.AddTail(coind->job); g_list_job.AddTail(coind->job);
CommonUnlock(&coind->mutex); CommonUnlock(&coind->mutex);
// debuglog("coind_create_job %s %d new job %x\n", coind->name, coind->height, coind->job->id); debuglog("coind_create_job %s %d new job %x\n", coind->name, coind->height, coind->job->id);
return true; return true;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB