[ADDED] Verbose mode
This commit is contained in:
parent
18421b32af
commit
8bbf96ae00
@ -29,13 +29,15 @@ chdir(dirname(__FILE__));
|
||||
// Include all settings and classes
|
||||
require_once('shared.inc.php');
|
||||
// Command line options
|
||||
$options = getopt("hl:r:t:");
|
||||
$options = getopt("hvl:r:t:");
|
||||
isset($options['l']) ? $limit = (int)$options['l'] : $limit = (int)1000;
|
||||
isset($options['r']) ? $rpclimit = (int)$options['r'] : $rpclimit = (int)10000;
|
||||
isset($options['t']) ? $customtxfee = (float)$options['t'] : $customtxfee = (float)0.1;
|
||||
isset($options['v']) ? $verbose = true : $verbose = false;
|
||||
if (isset($options['h'])) {
|
||||
echo "Usage " . basename($argv[0]) . " [-l #] [-c #]:" . PHP_EOL;
|
||||
echo " -h : Show this help" . PHP_EOL;
|
||||
echo " -v : Verbose mode, will show RPC transactions not matched against DB" . PHP_EOL;
|
||||
echo " -l # : Limit to # last database debit AP/MP transactions, default 1000" . PHP_EOL;
|
||||
echo " -c # : Limit to # last transactions, default 10000" . PHP_EOL;
|
||||
echo " -t # : Check against a custom TX Fee too, default 0.1" . PHP_EOL;
|
||||
@ -59,6 +61,7 @@ foreach ($aListTransactions as $key => $aTransaction) {
|
||||
|
||||
// Initilize counters
|
||||
$total=count($aListTransactions);
|
||||
$aMissingRPCMatches = array();
|
||||
$found=0;
|
||||
$notfound=0;
|
||||
|
||||
@ -86,17 +89,39 @@ foreach ($aAllDebitTxs as $aDebitTx) {
|
||||
$txid = $aTransaction['txid'];
|
||||
}
|
||||
}
|
||||
if (!$bFound) $status = 'MISSING';
|
||||
if (!$bFound) {
|
||||
$status = 'MISSING';
|
||||
$aMissingRPCMatches[] = $aDebitTx;
|
||||
}
|
||||
printf($mask, $aDebitTx['id'], $aDebitTx['username'], $aDebitTx['coin_address'], $aDebitTx['amount'], $status, $txid);
|
||||
}
|
||||
|
||||
// Small summary
|
||||
echo PHP_EOL . 'Please be aware that transaction prior to a transaction fee change may be marked as MISSING.' . PHP_EOL;
|
||||
echo 'See help on how to apply a custom transaction fee that can also be checked against.' . PHP_EOL;
|
||||
echo PHP_EOL . 'Summary: ' . PHP_EOL;
|
||||
echo 'See help on how to apply a custom transaction fee that can also be checked against. You can also enable verbose mode.' . PHP_EOL;
|
||||
echo PHP_EOL . 'Summary' . PHP_EOL;
|
||||
echo ' DB Debit Transaction Limit: ' . $limit . PHP_EOL;
|
||||
echo ' RPC Transaction Limit: ' . $rpclimit . PHP_EOL;
|
||||
echo ' Custom TX Fee Checked: ' . $customtxfee . 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;
|
||||
|
||||
if ($verbose) {
|
||||
if (count($aListTransactions) > 0) {
|
||||
$mask = "| %-40.40s | %-15.15s | %-65.65s |" . PHP_EOL;
|
||||
echo PHP_EOL . 'Here a list of RPC transactions that have not matched any DB records:' . PHP_EOL . PHP_EOL;
|
||||
printf($mask, 'Address', 'Amount', 'TX ID');
|
||||
foreach ($aListTransactions as $aTransaction) {
|
||||
printf($mask, $aTransaction['address'], $aTransaction['amount'], $aTransaction['txid']);
|
||||
}
|
||||
}
|
||||
if (count($aMissingRPCMatches) > 0) {
|
||||
$mask = "| %-40.40s | %-15.15s | %-8.8s | %-35.35s |" . PHP_EOL;
|
||||
echo PHP_EOL . 'Here a list of DB transactions that have not matched any RPC records:' . PHP_EOL . PHP_EOL;
|
||||
printf($mask, 'Address', 'Amount', 'DB ID', 'Username');
|
||||
foreach ($aMissingRPCMatches as $aDebitTx) {
|
||||
printf($mask, $aDebitTx['coin_address'], $aDebitTx['amount'], $aDebitTx['id'], $aDebitTx['username']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user