Merge pull request #1876 from MPOS/block-confirmations

[FIX] Workaround for missing confirmations
This commit is contained in:
Sebastian Grewe 2014-03-03 10:13:26 +01:00
commit 82a648f1c4
2 changed files with 12 additions and 3 deletions

View File

@ -54,10 +54,18 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
$log->logInfo(sprintf($strLogMask, $aBlock['id'], $aBlock['height'], $aBlock['blockhash'], $aBlock['confirmations'], $aBlockInfo['confirmations'], $status));
continue;
}
if ($aBlock['confirmations'] == $aBlockInfo['confirmations']) {
if (isset($aBlockInfo['confirmations'])) {
$iRPCConfirmations = $aBlockInfo['confirmations'];
} else if (isset($aTxDetails['confirmations'])) {
$iRPCConfirmations = $aTxDetails['confirmations'];
} else {
$log->logFatal(' RPC does not return any usable block confirmation information');
$monitoring->endCronjob($cron_name, 'E0082', 1, true);
}
if ($iRPCConfirmations == $aBlock['confirmations']) {
continue;
} else {
if (!$block->setConfirmations($aBlock['id'], $aBlockInfo['confirmations'])) {
if (!$block->setConfirmations($aBlock['id'], $iRPCConfirmations)) {
$log->logError(' Failed to update block confirmations: ' . $block->getCronMessage());
$status = 'ERROR';
} else {
@ -67,7 +75,7 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
$log->logInfo(sprintf($strLogMask, 'ID', 'Height', 'Blockhash', 'Old', 'New', 'Status'));
$header = true;
}
$log->logInfo(sprintf($strLogMask, $aBlock['id'], $aBlock['height'], $aBlock['blockhash'], $aBlock['confirmations'], $aBlockInfo['confirmations'], $status));
$log->logInfo(sprintf($strLogMask, $aBlock['id'], $aBlock['height'], $aBlock['blockhash'], $aBlock['confirmations'], $iRPCConfirmations, $status));
}
}

View File

@ -77,4 +77,5 @@ $aErrorCodes['E0078'] = 'RPC method did not return 200 OK';
$aErrorCodes['E0079'] = 'Wallet does not cover payouts total amount';
$aErrorCodes['E0080'] = 'No new unaccounted shares since last run';
$aErrorCodes['E0081'] = 'Failed to insert new block into database';
$aErrorCodes['E0082'] = 'Block does not supply any usable confirmation information';
?>