diff --git a/cronjobs/sharecounter.php b/cronjobs/sharecounter.php new file mode 100644 index 00000000..0a5ce6fe --- /dev/null +++ b/cronjobs/sharecounter.php @@ -0,0 +1,49 @@ +getAll('ASC'); + +foreach ($aAllBlocks as $iIndex => $aBlock) { + if (!$aBlock['accounted']) { + $iPrevBlockTime = $aAllBlocks[$iIndex - 1]['time']; + if ($iPrevBlockTime) { + echo "Found a previous block with timestamp: $iPrevBlockTime\n"; + } + $aAccountShares = $share->getSharesForAccountsByTimeframe($aBlock['time'], $iPrevBlockTime); + $strFinder = $share->getFinderByTimeframe($aBlock['time'], $iPrevBlockTime); + echo "Block Information:\n"; + echo "Height\tTime\t\tFinder\n\n"; + echo $aBlock['height'] . "\t" . $aBlock['time'] . "\t" . $strFinder . "\n"; + echo "\nShares details:\n\n"; + echo "ID\tUsername\tValid\tInvalid\n\n"; + foreach ($aAccountShares as $aData) { + echo $aData['id'] . "\t" . $aData['username'] . "\t" . $aData['valid'] . "\t" . $aData['invalid'] . "\n"; + } + echo "\n"; + // TODO: Find all shares for this blocks round and account the users + // propotional to their shares for this block + } + // TODO: We have accounted all shares for a block so mark it accounted + // and delete all the shares we just accounted for. +}