Browse Source

ckdb/php - allow putting a hold on payouts - they end up in dust in pplns2

master
kanoi 9 years ago
parent
commit
5b0de0a6eb
  1. 11
      pool/page_pplns2.php
  2. 7
      src/ckdb.h
  3. 10
      src/ckdb_cmd.c

11
pool/page_pplns2.php

@ -40,6 +40,15 @@ function calctx($ans, $count, $miner_sat, $diffacc_total)
$diffacc_user = $ans['diffacc:'.$i]; $diffacc_user = $ans['diffacc:'.$i];
$pay_sat = $ans['amount:'.$i]; $pay_sat = $ans['amount:'.$i];
$payaddress = $ans['payaddress:'.$i]; $payaddress = $ans['payaddress:'.$i];
if ($payaddress == 'hold')
{
$dd = '';
if ($pay_sat > 0 && $pay_sat < $dust)
$dd = ' (dust)';
$ers .= "Hold for '$username'$dd ($pay_sat)<br>";
$unpaid += $pay_sat;
continue;
}
if ($payaddress == 'none') if ($payaddress == 'none')
{ {
$c0 = substr($username, 0, 1); $c0 = substr($username, 0, 1);
@ -54,7 +63,7 @@ function calctx($ans, $count, $miner_sat, $diffacc_total)
$dd = ''; $dd = '';
if ($pay_sat < $dust) if ($pay_sat < $dust)
$dd = ' (dust)'; $dd = ' (dust)';
$ers .= "No address for '$username'$dd<br>"; $ers .= "No address for '$username'$dd ($pay_sat)<br>";
} }
$unpaid += $pay_sat; $unpaid += $pay_sat;
continue; continue;

7
src/ckdb.h

@ -51,7 +51,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.5" #define DB_VERSION "1.0.5"
#define CKDB_VERSION DB_VERSION"-1.982" #define CKDB_VERSION DB_VERSION"-1.983"
#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__
@ -1975,6 +1975,11 @@ extern K_LIST *process_pplns_free;
#define PAYOUTS_REJECT_STR "R" #define PAYOUTS_REJECT_STR "R"
#define PAYREJECT(_status) ((_status)[0] == PAYOUTS_REJECT) #define PAYREJECT(_status) ((_status)[0] == PAYOUTS_REJECT)
// UserAtts to hold payouts
#define HOLD_PAYOUTS "HoldPayouts"
#define HOLD_ADDRESS "hold"
#define NONE_ADDRESS "none"
// Default number of shifts (payouts) to display on web // Default number of shifts (payouts) to display on web
#define SHIFTS_DEFAULT 99 #define SHIFTS_DEFAULT 99
/* OptionControl can override it /* OptionControl can override it

10
src/ckdb_cmd.c

@ -4761,7 +4761,7 @@ static char *cmd_pplns2(__maybe_unused PGconn *conn, char *cmd, char *id,
char *block_extra, *marks_status = EMPTY; char *block_extra, *marks_status = EMPTY;
size_t siz = sizeof(reply); size_t siz = sizeof(reply);
K_ITEM *i_height; K_ITEM *i_height;
K_ITEM b_look, *b_item, *p_item, *mp_item, *pay_item, *u_item; K_ITEM b_look, *b_item, *p_item, *mp_item, *pay_item, *u_item, *ua_item;
K_ITEM *w_item; K_ITEM *w_item;
MININGPAYOUTS *miningpayouts; MININGPAYOUTS *miningpayouts;
PAYMENTS *payments; PAYMENTS *payments;
@ -4920,6 +4920,9 @@ static char *cmd_pplns2(__maybe_unused PGconn *conn, char *cmd, char *id,
goto shazbot; goto shazbot;
} }
DATA_USERS(users, u_item); DATA_USERS(users, u_item);
K_RLOCK(useratts_free);
ua_item = find_useratts(miningpayouts->userid, HOLD_PAYOUTS);
K_RUNLOCK(useratts_free);
K_RLOCK(payments_free); K_RLOCK(payments_free);
pay_item = find_first_paypayid(miningpayouts->userid, pay_item = find_first_paypayid(miningpayouts->userid,
@ -4936,7 +4939,8 @@ static char *cmd_pplns2(__maybe_unused PGconn *conn, char *cmd, char *id,
"amount:%d=%"PRId64"%c" "amount:%d=%"PRId64"%c"
"diffacc:%d=%.1f%c", "diffacc:%d=%.1f%c",
rows, payments->subname, FLDSEP, rows, payments->subname, FLDSEP,
rows, payments->payaddress, FLDSEP, rows, ua_item ? HOLD_ADDRESS :
payments->payaddress, FLDSEP,
rows, payments->amount, FLDSEP, rows, payments->amount, FLDSEP,
rows, payments->diffacc, FLDSEP); rows, payments->diffacc, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
@ -4954,7 +4958,7 @@ static char *cmd_pplns2(__maybe_unused PGconn *conn, char *cmd, char *id,
"amount:%d=%"PRId64"%c" "amount:%d=%"PRId64"%c"
"diffacc:%d=%.1f%c", "diffacc:%d=%.1f%c",
rows, users->username, FLDSEP, rows, users->username, FLDSEP,
rows, "none", FLDSEP, rows, NONE_ADDRESS, FLDSEP,
rows, miningpayouts->amount, FLDSEP, rows, miningpayouts->amount, FLDSEP,
rows, miningpayouts->diffacc, FLDSEP); rows, miningpayouts->diffacc, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);

Loading…
Cancel
Save