Browse Source

php - add address and 1.5% to pplns

master
kanoi 10 years ago
parent
commit
5837652c58
  1. 28
      pool/page_pplns.php
  2. 32
      src/ckdb.c

28
pool/page_pplns.php

@ -90,6 +90,8 @@ Block: <input type=text name=blk size=10 value=''>
$pg .= '<td class=dr>%</td>'; $pg .= '<td class=dr>%</td>';
$pg .= '<td class=dr>Base BTC</td>'; $pg .= '<td class=dr>Base BTC</td>';
$pg .= '<td class=dr>Avg Hashrate</td>'; $pg .= '<td class=dr>Avg Hashrate</td>';
$pg .= '<td class=dr>BTC -1.5%</td>';
$pg .= '<td class=dr>Address</td>';
$pg .= "</tr>\n"; $pg .= "</tr>\n";
$diffacc_total = $ans['diffacc_total']; $diffacc_total = $ans['diffacc_total'];
@ -98,12 +100,18 @@ Block: <input type=text name=blk size=10 value=''>
$reward = $ans['block_reward'] / pow(10,8); $reward = $ans['block_reward'] / pow(10,8);
$elapsed = $ans['pplns_elapsed']; $elapsed = $ans['pplns_elapsed'];
$count = $ans['rows']; $count = $ans['rows'];
$tot_btc = 0;
$tot_pay = 0;
for ($i = 0; $i < $count; $i++) for ($i = 0; $i < $count; $i++)
{ {
$diffacc_user = $ans['diffacc_user:'.$i]; $diffacc_user = $ans['diffacc_user:'.$i];
$diffacc_percent = number_format(100.0 * $diffacc_user / $diffacc_total, 2).'%'; $diffacc_percent = number_format(100.0 * $diffacc_user / $diffacc_total, 2).'%';
$diffacc_btc = number_format($reward * $diffacc_user / $diffacc_total, 8); $base_btc = $reward * $diffacc_user / $diffacc_total;
$diffacc_btc = number_format($base_btc, 8);
$avg_hash = number_format($diffacc_user / $elapsed * pow(2,32), 0); $avg_hash = number_format($diffacc_user / $elapsed * pow(2,32), 0);
$pay_btc = $base_btc * 0.985;
$dsp_btc = number_format($pay_btc, 8);
$payaddress = $ans['payaddress:'.$i];
if (($i % 2) == 0) if (($i % 2) == 0)
$row = 'even'; $row = 'even';
@ -116,8 +124,26 @@ Block: <input type=text name=blk size=10 value=''>
$pg .= "<td class=dr>$diffacc_percent</td>"; $pg .= "<td class=dr>$diffacc_percent</td>";
$pg .= "<td class=dr>$diffacc_btc</td>"; $pg .= "<td class=dr>$diffacc_btc</td>";
$pg .= "<td class=dr>$avg_hash</td>"; $pg .= "<td class=dr>$avg_hash</td>";
$pg .= "<td class=dr>$dsp_btc</td>";
$pg .= "<td class=dr>$payaddress</td>";
$pg .= "</tr>\n"; $pg .= "</tr>\n";
$tot_btc += $base_btc;
$tot_pay += $pay_btc;
} }
if (($i % 2) == 0)
$row = 'even';
else
$row = 'odd';
$pg .= "<tr class=$row>";
$pg .= '<td class=dl colspan=3></td>';
$pg .= "<td class=dr>".number_format($tot_btc,8)."</td>";
$pg .= '<td class=dr></td>';
$pg .= '<td class=dr>'.number_format($pay_btc,8).'</td>';
$pg .= '<td class=dr></td>';
$pg .= "</tr>\n";
$pg .= "</table>\n"; $pg .= "</table>\n";
} }

32
src/ckdb.c

@ -47,7 +47,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "0.9" #define DB_VERSION "0.9"
#define CKDB_VERSION DB_VERSION"-0.273" #define CKDB_VERSION DB_VERSION"-0.275"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@ -10012,18 +10012,28 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id,
u_item = find_userid(miningpayouts->userid); u_item = find_userid(miningpayouts->userid);
K_RUNLOCK(users_free); K_RUNLOCK(users_free);
if (u_item) { if (u_item) {
K_ITEM *pa_item;
PAYMENTADDRESSES *pa;
char *payaddress;
pa_item = find_paymentaddresses(miningpayouts->userid);
if (pa_item) {
DATA_PAYMENTADDRESSES(pa, pa_item);
payaddress = pa->payaddress;
} else
payaddress = "none";
DATA_USERS(users, u_item); DATA_USERS(users, u_item);
snprintf(tmp, sizeof(tmp), snprintf(tmp, sizeof(tmp),
"user:%d=%s%c", "user:%d=%s%cpayaddress:%d=%s%c",
rows, rows, users->username, FLDSEP,
users->username, rows, payaddress, FLDSEP);
FLDSEP);
} else { } else {
snprintf(tmp, sizeof(tmp), snprintf(tmp, sizeof(tmp),
"user:%d=%"PRId64"%c", "user:%d=%"PRId64"%cpayaddress:%d=none%c",
rows, rows, miningpayouts->userid, FLDSEP,
miningpayouts->userid, rows, FLDSEP);
FLDSEP);
} }
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
@ -10038,9 +10048,9 @@ static char *cmd_pplns(__maybe_unused PGconn *conn, char *cmd, char *id,
rows++; rows++;
} }
snprintf(tmp, sizeof(tmp), snprintf(tmp, sizeof(tmp),
"rows=%d%c,flds=%s%c", "rows=%d%cflds=%s%c",
rows, FLDSEP, rows, FLDSEP,
"user,diffacc_user", FLDSEP); "user,diffacc_user,payaddress", FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
snprintf(tmp, sizeof(tmp), "arn=%s%carp=%s%c", snprintf(tmp, sizeof(tmp), "arn=%s%carp=%s%c",

Loading…
Cancel
Save