Skip to content

Commit

Permalink
stratum: dev/charity fees for coins with masternodes (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
opensourcerulez authored and tpruvot committed Jun 11, 2018
1 parent 7afdd17 commit 9dbce85
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion stratum/coinbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void coinbase_create(YAAMP_COIND *coind, YAAMP_JOB_TEMPLATE *templ, json_value *
}

// 2 txs are required on these coins, one for foundation (dev fees)
if(coind->charity_percent)
if(coind->charity_percent && !coind->hasmasternodes)
{
char script_payee[1024];
char charity_payee[256] = { 0 };
Expand Down Expand Up @@ -301,6 +301,20 @@ void coinbase_create(YAAMP_COIND *coind, YAAMP_JOB_TEMPLATE *templ, json_value *
debuglog("%s is using old masternodes rpc keys\n", coind->symbol);
return;
}
if(coind->charity_percent) {
char charity_payee[256] = { 0 };
const char *payee = json_get_string(json_result, "payee");
if (payee) snprintf(charity_payee, 255, "%s", payee);
else sprintf(charity_payee, "%s", coind->charity_address);
if (strlen(charity_payee) == 0)
stratumlog("ERROR %s has no charity_address set!\n", coind->name);
json_int_t charity_amount = (available * coind->charity_percent) / 100;
npayees++;
available -= charity_amount;
coind->charity_amount = charity_amount;
base58_decode(charity_payee, script_payee);
job_pack_tx(coind, script_dests, charity_amount, script_payee);
}
if(superblocks_enabled && superblock) {
for(int i = 0; i < superblock->u.array.length; i++) {
const char *payee = json_get_string(superblock->u.array.values[i], "payee");
Expand Down

0 comments on commit 9dbce85

Please sign in to comment.