fixing pps payout, getRoundShares system MUST be search by ID or round shares are NOT calculated properly
This commit is contained in:
parent
b8c6e16452
commit
9536e7c193
@ -43,8 +43,7 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$aAccountShares = $share->getSharesForAccounts($share->getLastUpstreamId(), $iCurrentUpstreamId);
|
$aAccountShares = $share->getSharesForAccounts($share->getLastUpstreamId(), $iCurrentUpstreamId);
|
||||||
$aRoundShares = $share->getRoundShares($share->getLastUpstreamId(), $iCurrentUpstreamId);
|
$iRoundShares = $share->getRoundShares($share->getLastUpstreamId(), $iCurrentUpstreamId);
|
||||||
$iRoundShares = $aRoundShares['valid'];
|
|
||||||
verbose("ID\tHeight\tTime\t\tShares\tFinder\t\tShare ID\tPrev Share\tStatus\n");
|
verbose("ID\tHeight\tTime\t\tShares\tFinder\t\tShare ID\tPrev Share\tStatus\n");
|
||||||
verbose($aBlock['id'] . "\t" . $aBlock['height'] . "\t" . $aBlock['time'] . "\t" . $iRoundShares . "\t" . $share->getUpstreamFinder() . "\t" . $share->getUpstreamId() . "\t\t" . $share->getLastUpstreamId());
|
verbose($aBlock['id'] . "\t" . $aBlock['height'] . "\t" . $aBlock['time'] . "\t" . $iRoundShares . "\t" . $share->getUpstreamFinder() . "\t" . $share->getUpstreamId() . "\t\t" . $share->getLastUpstreamId());
|
||||||
if (empty($aAccountShares)) {
|
if (empty($aAccountShares)) {
|
||||||
|
|||||||
@ -34,25 +34,19 @@ class Share {
|
|||||||
return $this->table;
|
return $this->table;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRoundShares() {
|
public function getRoundShares($previous_upstream=0, $current_upstream) {
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("SELECT
|
||||||
SELECT
|
count(id) as total
|
||||||
( SELECT IFNULL(count(id), 0)
|
|
||||||
FROM $this->table
|
|
||||||
WHERE UNIX_TIMESTAMP(time) >IFNULL((SELECT MAX(time) FROM blocks),0)
|
|
||||||
AND our_result = 'Y' ) as valid,
|
|
||||||
( SELECT IFNULL(count(id), 0)
|
|
||||||
FROM $this->table
|
FROM $this->table
|
||||||
WHERE UNIX_TIMESTAMP(time) >IFNULL((SELECT MAX(time) FROM blocks),0)
|
WHERE our_result = 'Y'
|
||||||
AND our_result = 'N' ) as invalid
|
AND id BETWEEN ? AND ?
|
||||||
");
|
");
|
||||||
echo $this->mysqli->error;
|
|
||||||
if ($this->checkStmt($stmt)) {
|
if ($this->checkStmt($stmt)) {
|
||||||
|
$stmt->bind_param('ii', $previous_upstream, $current_upstream);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
return $result->fetch_assoc();
|
return $result->fetch_object()->total;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user