From fb694336fafe9d5bdc391357d64da84789abee28 Mon Sep 17 00:00:00 2001 From: Flavius Date: Fri, 9 Mar 2018 22:29:05 -0700 Subject: [PATCH 1/2] WAE Adjustment & Masternode Integration --- stratum/coinbase.cpp | 81 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/stratum/coinbase.cpp b/stratum/coinbase.cpp index a604f1522..7ed909f84 100644 --- a/stratum/coinbase.cpp +++ b/stratum/coinbase.cpp @@ -109,6 +109,87 @@ void coinbase_create(YAAMP_COIND *coind, YAAMP_JOB_TEMPLATE *templ, json_value * coind->charity_percent = 10; if (strlen(coind->charity_address) == 0) sprintf(coind->charity_address, "BCDrF1hWdKTmrjXXVFTezPjKBmGigmaXg5"); + }else if(strcmp(coind->symbol, "WAE") == 0) { + char script_dests[1024] = { 0 }; + char script_payee[1024]; + char payee_address[1024]; + char payees[4]; + int npayees = 1; + + bool masternode_payments = true; + bool masternodes_enabled = true; + if (masternodes_enabled && masternode_payments) { + const char *payee = json_get_string(json_result, "payee"); + json_int_t amount = json_get_int(json_result, "payee_amount"); + if (payee && amount) + ++npayees; + } + + // treasury 5% @ 10 STAK per block + json_int_t charity_amount = 0; + + //testnet + //sprintf(coind->charity_address, "93ASJtDuVYVdKXemH9BrtSMscznvsp9stD"); + + switch (templ->height % 4) { + case 0: sprintf(coind->charity_address, "KfzDtWeER35PwedRswa9hG1EbaMnFoMZcf"); + break; + case 1: sprintf(coind->charity_address, "KfzDtWeER35PwedRswa9hG1EbaMnFoMZcf"); + break; + case 2: sprintf(coind->charity_address, "KfzDtWeER35PwedRswa9hG1EbaMnFoMZcf"); + break; + case 3: sprintf(coind->charity_address, "KfzDtWeER35PwedRswa9hG1EbaMnFoMZcf"); + break; + } + + //stratumlog("[squbs] templ->height = %d, templ->height % 4 = %d, devfee_payee = %s\n", templ->height, templ->height % 4, coind->charity_address); + + ++npayees; + available -= charity_amount; + + strcpy(payee_address,coind->charity_address); + base58_decode(payee_address, script_payee); + + //stratumlog("[squbs] * script_payee = %s\n", script_payee); + + sprintf(payees, "%02x", npayees); + strcat(templ->coinb2, payees); + + //stratumlog("[squbs] 0: templ->coinb2 = %s\n",templ->coinb2); + + char echarity_amount[32]; + encode_tx_value(echarity_amount, charity_amount); + strcat(templ->coinb2, echarity_amount); + + char coinb2_part[1024] = {0}; + char coinb2_len[3] = {0}; + + sprintf(coinb2_part, "a9%02x%s87", (unsigned int) (strlen(script_payee) >> 1) & 0xFF, script_payee ); + sprintf(coinb2_len, "%02x", (unsigned int) (strlen(coinb2_part) >> 1) & 0xFF ); + strcat(templ->coinb2,coinb2_len); + strcat(templ->coinb2,coinb2_part); + + //stratumlog("[squbs] 1: templ->coinb2 = %s\n",templ->coinb2); + +// if (masternodes_enabled && masternode_payments) { + //duplicated: revisit ++todo + const char *payee = json_get_string(json_result, "payee"); + json_int_t amount = json_get_int(json_result, "payee_amount"); + if (payee && amount) { + available -= amount; + base58_decode(payee, script_payee); + job_pack_tx(coind, templ->coinb2, amount, script_payee); + } +// } + + job_pack_tx(coind, templ->coinb2, available, NULL); + //stratumlog("[squbs] 2: templ->coinb2 = %s\n",templ->coinb2); + + strcat(templ->coinb2, "00000000"); // locktime + + //coind->reward = (double)available/100000000*coind->reward_mul; + coind->reward = (double)available/1200000000*coind->reward_mul; + return; } else if(strcmp(coind->symbol, "XZC") == 0) { char script_payee[1024]; From af9505b4938522b4f95dd8d5a6ae59ce5cb1571c Mon Sep 17 00:00:00 2001 From: Flavius Date: Tue, 27 Mar 2018 18:00:39 -0600 Subject: [PATCH 2/2] Update coinbase.cpp --- stratum/coinbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stratum/coinbase.cpp b/stratum/coinbase.cpp index 7ed909f84..ffdc4c15e 100644 --- a/stratum/coinbase.cpp +++ b/stratum/coinbase.cpp @@ -188,7 +188,7 @@ void coinbase_create(YAAMP_COIND *coind, YAAMP_JOB_TEMPLATE *templ, json_value * strcat(templ->coinb2, "00000000"); // locktime //coind->reward = (double)available/100000000*coind->reward_mul; - coind->reward = (double)available/1200000000*coind->reward_mul; + coind->reward = (double)available/600000000*coind->reward_mul; return; } else if(strcmp(coind->symbol, "XZC") == 0) {