diff --git a/pool/page_pplns.php b/pool/page_pplns.php
index 1470d59f..1b46dd0e 100644
--- a/pool/page_pplns.php
+++ b/pool/page_pplns.php
@@ -14,6 +14,102 @@ function stnum($num)
return $b4.$fmt.$af;
}
#
+# ... Of course ... check the output and add the txin
+function calctx($ans, $count, $miner_sat, $diffacc_total)
+{
+ $pg = '
';
+
+ $dust = getparam('dust', true);
+ if (nuem($dust) || $dust <= 0)
+ $dust = 10000;
+
+ $fee = getparam('fee', true);
+ if (nuem($fee) || $fee < 0)
+ $fee = 0;
+ $fee *= 100000000;
+
+ $adr = array();
+ $ers = '';
+ $unpaid = 0;
+ $change = $miner_sat;
+ $dust_amt = 0; # not included in $change
+ for ($i = 0; $i < $count; $i++)
+ {
+ $username = $ans['user:'.$i];
+ $diffacc_user = $ans['diffacc_user:'.$i];
+ $pay_sat = floor($miner_sat * $diffacc_user / $diffacc_total);
+ $payaddress = $ans['payaddress:'.$i];
+ if ($payaddress == 'none')
+ {
+ $len = strlen($username);
+ $c0 = substr($username, 0, 1);
+ if (($c0 == '1' || $c0 == '3') && $len > 26 && $len < 37)
+ $payaddress = $username;
+ else
+ {
+ if ($pay_sat > 0)
+ {
+ $dd = '';
+ if ($pay_sat < $dust)
+ $dd = ' (dust)';
+ $ers .= "No address for '$username'$dd "; + } + $unpaid += $pay_sat; + continue; + } + } + if (isset($adr[$payaddress])) + $adr[$payaddress] += $pay_sat; + else + $adr[$payaddress] = $pay_sat; + + $change -= $pay_sat; + } + + $txout = ''; + $comma = ''; + foreach ($adr as $payaddress => $pay_sat) + { + if ($pay_sat < $dust) + $dust_amt += $pay_sat; + else + { + $txout .= "$comma\"$payaddress\":".btcfmt($pay_sat); + $comma = ', '; + } + } + + if ($change > 0 || $dust_amt > 0 || $change < $fee) + { + $pg .= "Dust limit = $dust = ".btcfmt($dust); + $pg .= ", Dust amount = $dust_amt = ".btcfmt($dust_amt); + $pg .= ", Upaid = $unpaid = ".btcfmt($unpaid); + $pg .= ", Change = $change = ".btcfmt($change); + $pg .= ", Fee = $fee = ".btcfmt($fee)." "; + + if ($change < $fee) + $ers .= "Change ($change) is less than Fee ($fee) "; + + if (($dust_amt + $change - $fee) > 0) + { + $txout .= "$comma\"<changeaddress>\":"; + $txout .= btcfmt($dust_amt + $change - $fee); + $comma = ', '; + } + } + + if (strlen($ers) > 0) + $pg .= "$ers "; + + $txn = '[{"txid":"<txid1>","vout":<n>},'; + $txn .= '{"txid":"<txid2>","vout":<n>}] '; + $txn .= '{'.$txout.'} '; + + $pg .= $txn.' |
User | '; $pg .= 'Diff Accepted | '; $pg .= '% | '; - $pg .= 'Base BTC | '; $pg .= 'Avg Hashrate | '; - $pg .= 'BTC -1.5% | '; + $pg .= 'BTC -0.9% | '; $pg .= 'Address | '; $pg .= "'.$ans['user:'.$i].' | '; $pg .= "$diffacc_user | "; $pg .= "$diffacc_percent | "; - $pg .= "$diffacc_btc | "; $pg .= "$avg_hash | "; - $pg .= "$dsp_btc | "; + $pg .= ''.btcfmt($pay_sat).' | '; $pg .= "$payaddress | "; $pg .= "\n"; - $tot_btc += $base_btc; - $tot_pay += $pay_btc; + $tot_pay += $pay_sat; } if (($i % 2) == 0) $row = 'even'; @@ -139,13 +248,14 @@ Block: $pg .= "
'; - $pg .= " | ".number_format($tot_btc,8)." | "; $pg .= ''; - $pg .= ' | '.number_format($tot_pay,8).' | '; + $pg .= ''.btcfmt($tot_pay).' | '; $pg .= ''; $pg .= " |