Merge pull request #719 from TheSerapher/issue-715

[FIX] Set block internally accounted for earlier
This commit is contained in:
Sebastian Grewe 2013-10-12 10:55:13 -07:00
commit 985777df71
2 changed files with 6 additions and 4 deletions

View File

@ -175,6 +175,9 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
$log->logFatal('Failed to insert new Donation transaction to database for ' . $aData['username']);
}
// Store this blocks height as last accounted for
$setting->setValue('last_accounted_block_height', $aBlock['height']);
// Move counted shares to archive before this blockhash upstream share
if (!$share->moveArchive($iCurrentUpstreamId, $aBlock['id'], $iPreviousShareId))
$log->logError('Failed to copy shares to archive table');
@ -183,8 +186,6 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
$log->logFatal("Failed to delete accounted shares from $iPreviousShareId to $iCurrentUpstreamId, aborting!");
exit(1);
}
// Store this blocks height as last accounted for
$setting->setValue('last_accounted_block_height', $aBlock['height']);
// Mark this block as accounted for
if (!$block->setAccounted($aBlock['id'])) {
$log->logFatal("Failed to mark block as accounted! Aborting!");

View File

@ -100,6 +100,9 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
$log->logFatal('Failed to insert new Donation transaction to database for ' . $aData['username']);
}
// Add block as accounted for into settings table
$setting->setValue('last_accounted_block_height', $aBlock['height']);
// Move counted shares to archive before this blockhash upstream share
if (!$share->moveArchive($iCurrentUpstreamId, $aBlock['id'], $iPreviousShareId))
$log->logError('Failed to copy shares to archive');
@ -111,8 +114,6 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
$monitoring->setStatus($cron_name . "_status", "okerror", 1);
exit(1);
}
// Add block as accounted for into settings table
$setting->setValue('last_accounted_block_height', $aBlock['height']);
// Mark this block as accounted for
if (!$block->setAccounted($aBlock['id'])) {
$log->logFatal('Failed to mark block as accounted! Aborted.');