getAll('ASC'); foreach ($aAllBlocks as $iIndex => $aBlock) { if (!$aBlock['accounted']) { $iPrevBlockTime = @$aAllBlocks[$iIndex - 1]['time']; if (!$iPrevBlockTime) { $iPrevBlockTime = 0; } $aAccountShares = $share->getSharesForAccountsByTimeframe($aBlock['time'], $iPrevBlockTime); $iRoundShares = $share->getRoundSharesByTimeframe($aBlock['time'], $iPrevBlockTime); $strFinder = $share->getFinderByTimeframe($aBlock['time'], $iPrevBlockTime); echo "ID\tHeight\tTime\t\tShares\tFinder\n"; echo $aBlock['id'] . "\t" . $aBlock['height'] . "\t" . $aBlock['time'] . "\t" . $iRoundShares . "\t" . $strFinder . "\n\n"; echo "ID\tUsername\tValid\tInvalid\tPercentage\tPayout\t\tStatus\n"; foreach ($aAccountShares as $key => $aData) { $aData['percentage'] = number_format(round(( 100 / $iRoundShares ) * $aData['valid'], 10),10); $aData['payout'] = number_format(round(( $aData['percentage'] / 100 ) * $config['reward'], 10), 10); echo $aData['id'] . "\t" . $aData['username'] . "\t" . $aData['valid'] . "\t" . $aData['invalid'] . "\t" . $aData['percentage'] . "\t" . $aData['payout'] . "\t"; // Do all database updates for statistics and payouts $strStatus = "OK"; // if (!$statistics->updateShareStatistics($aData, $aBlock['id'])) // $strStatus = "Stats Failed"; if (!$transaction->addCredit($aData['id'], $aData['payout'], $aBlock['id'])) $strStatus = "Transaction Failed"; echo "$strStatus\n"; } echo "------------------------------------------------------------------------\n\n"; // Now that we have all shares counted internally let's update the tables // Set shares as counted and mark block as accounted for $share->setCountedByTimeframe($aBlock['time'], $iPrevBlockTime); $block->setAccounted($aBlock['blockhash']); } }