#!/usr/bin/php getTransactions(0, array('type' => 'Debit_MP'), $limit); $aAllAPDebitTxs = $transaction->getTransactions(0, array('type' => 'Debit_AP'), $limit); $aAllDebitTxs = array_merge($aAllMPDebitTxs, $aAllAPDebitTxs); // Fetch transactions from RPC $aListTransactions = $bitcoin->listtransactions('', $rpclimit); // We don't need to loop through non-send transaction types foreach ($aListTransactions as $key => $aTransaction) { if ($aTransaction['category'] != 'send') { unset($aListTransactions[$key]); } } // Initilize counters $total=count($aListTransactions); $found=0; $notfound=0; // Output mask and header $mask = "| %-15.15s | %-34.34s | %20.20s | %10.10s | %-64.64s |" . PHP_EOL; printf($mask, 'Username', 'Address', 'Amount', 'Status', 'TXID'); // Loop through our DB records foreach ($aAllDebitTxs as $aDebitTx) { $bFound = false; $txid = 'n/a'; foreach($aListTransactions as $key => $aTransaction) { // Search for match NOT by txid if (isset($aTransaction['address']) && $aTransaction['address'] == $aDebitTx['coin_address'] && ($aTransaction['amount'] == ($aDebitTx['amount'] * -1) || $aTransaction['amount'] == ($aDebitTx['amount'] * -1 - $config['txfee_manual']) || $aTransaction['amount'] == ($aDebitTx['amount'] * -1 - $config['txfee_auto']) )) { unset($aListTransactions[$key]); $found++; $bFound = true; $status = 'FOUND'; $txid = $aTransaction['txid']; } } if (!$bFound) $status = 'MISSING'; printf($mask, $aDebitTx['username'], $aDebitTx['coin_address'], $aDebitTx['amount'], $status, $txid); } // Small summary echo PHP_EOL . 'Summary: ' . PHP_EOL; echo ' Total Send TX Records: ' . $total . PHP_EOL; echo ' Total Debit Records: ' . count($aAllDebitTxs) . PHP_EOL; echo ' Total Records Found: ' . $found . PHP_EOL;