stratum: some cleanup about coinbase and txmessage

txmessage/pos change was suggested by bitbandi...
This commit is contained in:
Tanguy Pruvot 2016-01-23 14:37:10 +01:00
parent 655ca8cd71
commit f4371654d7
3 changed files with 9 additions and 5 deletions

View file

@ -134,7 +134,8 @@ void client_do_submit(YAAMP_CLIENT *client, YAAMP_JOB *job, YAAMP_JOB_VALUES *su
for(i = templ->txdata.begin(); i != templ->txdata.end(); ++i)
sprintf(block_hex+strlen(block_hex), "%s", (*i).c_str());
if(coind->txmessage)
// POS coins need a zero byte appended to block, the daemon replaces it with the signature
if(coind->pos)
strcat(block_hex, "00");
bool b = coind_submit(coind, block_hex);
@ -169,9 +170,9 @@ void client_do_submit(YAAMP_CLIENT *client, YAAMP_JOB *job, YAAMP_JOB_VALUES *su
}
else {
debuglog("*** REJECTED :( %s %d\n", coind->name, templ->height);
debuglog("*** REJECTED :( %s block %d %d txs\n", coind->name, templ->height, templ->txcount);
#ifdef HASH_DEBUGLOG_
debuglog("block %s\n", block_hex);
//debuglog("block %s\n", block_hex);
debuglog("--------------------------------------------------------------\n");
#endif
}

View file

@ -98,7 +98,7 @@ void coinbase_create(YAAMP_COIND *coind, YAAMP_JOB_TEMPLATE *templ, json_value *
json_int_t available = templ->value;
// sample coins using mandatory dev/foundation fees
if(strcmp(coind->symbol, "EGC") == 0 && !coind->charity_percent) {
if(strcmp(coind->symbol, "EGC") == 0) {
if (coind->charity_percent <= 0)
coind->charity_percent = 2;
if (strlen(coind->charity_address) == 0)
@ -168,6 +168,9 @@ void coinbase_create(YAAMP_COIND *coind, YAAMP_JOB_TEMPLATE *templ, json_value *
job_pack_tx(coind, templ->coinb2, available, NULL);
strcat(templ->coinb2, "00000000"); // locktime
//if(coind->txmessage)
// strcat(templ->coinb2, "00");
coind->reward = (double)available/100000000*coind->reward_mul;
// debuglog("coinbase %f\n", coind->reward);

View file

@ -116,7 +116,7 @@ void clientlog(YAAMP_CLIENT *client, const char *format, ...)
time(&rawtime);
timeinfo = localtime(&rawtime);
strftime(buffer2, 80, "%Y/%m/%d %H:%M:%S", timeinfo);
strftime(buffer2, 80, "%Y-%m-%d %H:%M:%S", timeinfo);
char buffer3[YAAMP_SMALLBUFSIZE];
sprintf(buffer3, "%s [%s] %s, %s, %s\n", buffer2, client->sock->ip, client->username, g_current_algo->name, buffer);