change tx detection to check for orphaned blocks

This commit is contained in:
Sebastian Grewe 2013-05-29 12:14:30 +02:00
parent 43320a77d8
commit 36bfcf6b6b

View File

@ -34,7 +34,7 @@ verbose("ID\tBlockhash\tConfirmations\t\n");
foreach ($aAllBlocks as $iIndex => $aBlock) {
$aBlockInfo = $bitcoin->query('getblock', $aBlock['blockhash']);
// Fetch this blocks transaction details to find orphan blocks
$aTxDetails = $bitcoin->query('gettransaction', $aBlockInfo['merkleroot']);
$aTxDetails = $bitcoin->query('gettransaction', $aBlockInfo['tx'][0]);
verbose($aBlock['id'] . "\t" . $aBlock['blockhash'] . "\t" . $aBlock['confirmations'] . " -> " . $aBlockInfo['confirmations'] . "\t");
if ($aTxDetails['details'][0]['category'] == 'orphan') {
// We have an orphaned block, we need to invalidate all transactions for this one