diff --git a/cronjobs/findblock.php b/cronjobs/findblock.php index 025c1d3d..64d32914 100755 --- a/cronjobs/findblock.php +++ b/cronjobs/findblock.php @@ -66,11 +66,15 @@ if (empty($aTransactions['transactions'])) { } } +verbose("\n\n"); // Now with our blocks added we can scan for their upstream shares $aAllBlocks = $block->getAllUnaccounted('ASC'); +if (empty($aAllBlocks)) { + verbose("No new unaccounted blocks found\n"); +} // Loop through our unaccounted blocks -verbose("Block ID\tBlock Height\tShare ID\tFinder\t\t\tStatus\n"); +verbose("Block ID\tBlock Height\tShare ID\tShares\tFinder\t\t\tStatus\n"); foreach ($aAllBlocks as $iIndex => $aBlock) { if (empty($aBlock['share_id'])) { // Fetch this blocks upstream ID @@ -82,16 +86,24 @@ foreach ($aAllBlocks as $iIndex => $aBlock) { verbose($share->getError() . "\n"); continue; } + // Fetch share information + $iPreviousShareId = @$aAllBlocks[$iIndex - 1]['share_id'] ? $aAllBlocks[$iIndex - 1]['share_id'] : 0; + $iRoundShares = $share->getRoundShares($iPreviousShareId, $iCurrentUpstreamId); + // Store new information $strStatus = "OK"; if (!$block->setShareId($aBlock['id'], $iCurrentUpstreamId)) $strStatus = "Share ID Failed"; if (!$block->setFinder($aBlock['id'], $iAccountId)) $strStatus = "Finder Failed"; + if (!$block->setShares($aBlock['id'], $iRoundShares)) + $strStatus = "Shares Failed"; + verbose( $aBlock['id'] . "\t\t" . $aBlock['height'] . "\t\t" . $iCurrentUpstreamId . "\t\t" + . $iRoundShares . "\t" . "[$iAccountId] " . $user->getUserName($iAccountId) . "\t\t" . $strStatus . "\n" diff --git a/cronjobs/proportional_payout.php b/cronjobs/proportional_payout.php index d22d1f19..e99387f2 100755 --- a/cronjobs/proportional_payout.php +++ b/cronjobs/proportional_payout.php @@ -37,20 +37,11 @@ foreach ($aAllBlocks as $iIndex => $aBlock) { $aAccountShares = $share->getSharesForAccounts($iPreviousShareId, $aBlock['share_id']); $iRoundShares = $share->getRoundShares($iPreviousShareId, $aBlock['share_id']); - // Table header for block details - verbose("ID\tHeight\tTime\t\tShares\tFinder\t\tShare ID\tPrev Share\t\tStatus\n"); - verbose($aBlock['id'] . "\t" . $aBlock['height'] . "\t" . $aBlock['time'] . "\t" . $iRoundShares . "\t" . $user->getUserName($aBlock['account_id']) . "\t" . $iCurrentUpstreamId . "\t\t" . $iPreviousShareId); - if (empty($aAccountShares)) { verbose("\nNo shares found for this block\n\n"); sleep(2); continue; } - $strStatus = "OK"; - // Store share information for this block - if (!$block->setShares($aBlock['id'], $iRoundShares)) - $strStatus = "Shares Failed"; - verbose("\t\t$strStatus\n\n"); // Table header for account shares verbose("ID\tUsername\tValid\tInvalid\tPercentage\tPayout\t\tDonation\tFee\t\tStatus\n");