commit
288c2dd866
@ -66,14 +66,14 @@ if (! empty($users)) {
|
|||||||
|
|
||||||
// Send balance, fees are reduced later by RPC Server
|
// Send balance, fees are reduced later by RPC Server
|
||||||
try {
|
try {
|
||||||
$bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance - $config['txfee']);
|
$txid = $bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance - $config['txfee']);
|
||||||
} catch (BitcoinClientException $e) {
|
} catch (BitcoinClientException $e) {
|
||||||
$log->logError('Failed to send requested balance to coin address, please check payout process');
|
$log->logError('Failed to send requested balance to coin address, please check payout process');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create transaction record
|
// Create transaction record
|
||||||
if ($transaction->addTransaction($aUserData['id'], $dBalance - $config['txfee'], 'Debit_AP', NULL, $aUserData['coin_address']) && $transaction->addTransaction($aUserData['id'], $config['txfee'], 'TXFee', NULL, $aUserData['coin_address'])) {
|
if ($transaction->addTransaction($aUserData['id'], $dBalance - $config['txfee'], 'Debit_AP', NULL, $aUserData['coin_address'], $txid) && $transaction->addTransaction($aUserData['id'], $config['txfee'], 'TXFee', NULL, $aUserData['coin_address'])) {
|
||||||
// Mark all older transactions as archived
|
// Mark all older transactions as archived
|
||||||
if (!$transaction->setArchived($aUserData['id'], $transaction->insert_id))
|
if (!$transaction->setArchived($aUserData['id'], $transaction->insert_id))
|
||||||
$log->logError('Failed to mark transactions for user #' . $aUserData['id'] . ' prior to #' . $transaction->insert_id . ' as archived');
|
$log->logError('Failed to mark transactions for user #' . $aUserData['id'] . ' prior to #' . $transaction->insert_id . ' as archived');
|
||||||
|
|||||||
@ -64,13 +64,13 @@ if (count($aPayouts) > 0) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$bitcoin->sendtoaddress($aData['coin_address'], $dBalance - $config['txfee']);
|
$txid = $bitcoin->sendtoaddress($aData['coin_address'], $dBalance - $config['txfee']);
|
||||||
} catch (BitcoinClientException $e) {
|
} catch (BitcoinClientException $e) {
|
||||||
$log->logError('Failed to send requested balance to coin address, please check payout process');
|
$log->logError('Failed to send requested balance to coin address, please check payout process');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($transaction->addTransaction($aData['account_id'], $dBalance - $config['txfee'], 'Debit_MP', NULL, $aData['coin_address']) && $transaction->addTransaction($aData['account_id'], $config['txfee'], 'TXFee', NULL, $aData['coin_address'])) {
|
if ($transaction->addTransaction($aData['account_id'], $dBalance - $config['txfee'], 'Debit_MP', NULL, $aData['coin_address'], $txid) && $transaction->addTransaction($aData['account_id'], $config['txfee'], 'TXFee', NULL, $aData['coin_address'])) {
|
||||||
// Mark all older transactions as archived
|
// Mark all older transactions as archived
|
||||||
if (!$transaction->setArchived($aData['account_id'], $transaction->insert_id))
|
if (!$transaction->setArchived($aData['account_id'], $transaction->insert_id))
|
||||||
$log->logError('Failed to mark transactions for #' . $aData['account_id'] . ' prior to #' . $transaction->insert_id . ' as archived');
|
$log->logError('Failed to mark transactions for #' . $aData['account_id'] . ' prior to #' . $transaction->insert_id . ' as archived');
|
||||||
@ -82,7 +82,8 @@ if (count($aPayouts) > 0) {
|
|||||||
if (!$notification->sendNotification($aData['account_id'], 'manual_payout', $aMailData))
|
if (!$notification->sendNotification($aData['account_id'], 'manual_payout', $aMailData))
|
||||||
$log->logError('Failed to send notification email to users address: ' . $aMailData['email']);
|
$log->logError('Failed to send notification email to users address: ' . $aMailData['email']);
|
||||||
} else {
|
} else {
|
||||||
$log->logError('Failed to add new Debit_MP transaction in database for user ' . $user->getUserName($aData['account_id']));
|
$log->logFatal('Failed to add new Debit_MP transaction in database for user ' . $user->getUserName($aData['account_id']));
|
||||||
|
$monitoring->endCronjob($cron_name, 'E0064', 1, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,9 +18,9 @@ class Transaction extends Base {
|
|||||||
* @param coin_address string Coin address for this transaction [optional]
|
* @param coin_address string Coin address for this transaction [optional]
|
||||||
* @return bool
|
* @return bool
|
||||||
**/
|
**/
|
||||||
public function addTransaction($account_id, $amount, $type='Credit', $block_id=NULL, $coin_address=NULL) {
|
public function addTransaction($account_id, $amount, $type='Credit', $block_id=NULL, $coin_address=NULL, $txid=NULL) {
|
||||||
$stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, amount, block_id, type, coin_address) VALUES (?, ?, ?, ?, ?)");
|
$stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, amount, block_id, type, coin_address, txid) VALUES (?, ?, ?, ?, ?, ?)");
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param("idiss", $account_id, $amount, $block_id, $type, $coin_address) && $stmt->execute()) {
|
if ($this->checkStmt($stmt) && $stmt->bind_param("idisss", $account_id, $amount, $block_id, $type, $coin_address, $txid) && $stmt->execute()) {
|
||||||
$this->insert_id = $stmt->insert_id;
|
$this->insert_id = $stmt->insert_id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -109,6 +109,7 @@ class Transaction extends Base {
|
|||||||
t.amount AS amount,
|
t.amount AS amount,
|
||||||
t.coin_address AS coin_address,
|
t.coin_address AS coin_address,
|
||||||
t.timestamp AS timestamp,
|
t.timestamp AS timestamp,
|
||||||
|
t.txid AS txid,
|
||||||
b.height AS height,
|
b.height AS height,
|
||||||
b.blockhash AS blockhash,
|
b.blockhash AS blockhash,
|
||||||
b.confirmations AS confirmations
|
b.confirmations AS confirmations
|
||||||
|
|||||||
@ -67,4 +67,5 @@ $aErrorCodes['E0060'] = 'Failed to add new worker';
|
|||||||
$aErrorCodes['E0061'] = 'Failed to delete worker';
|
$aErrorCodes['E0061'] = 'Failed to delete worker';
|
||||||
$aErrorCodes['E0062'] = 'Block has no share_id, not running payouts';
|
$aErrorCodes['E0062'] = 'Block has no share_id, not running payouts';
|
||||||
$aErrorCodes['E0063'] = 'Upstream share already assigned to previous block';
|
$aErrorCodes['E0063'] = 'Upstream share already assigned to previous block';
|
||||||
|
$aErrorCodes['E0064'] = 'Failed to create transaction record';
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -68,14 +68,15 @@
|
|||||||
<table cellspacing="0" class="tablesorter" width="100%">
|
<table cellspacing="0" class="tablesorter" width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="center">TX #</th>
|
<th align="center">ID</th>
|
||||||
<th >Account</th>
|
<th>Account</th>
|
||||||
<th >Date</th>
|
<th>Date</th>
|
||||||
<th >TX Type</th>
|
<th>TX Type</th>
|
||||||
<th align="center">Status</th>
|
<th align="center">Status</th>
|
||||||
<th >Payment Address</th>
|
<th>Payment Address</th>
|
||||||
<th >Block #</th>
|
<th>TX #</th>
|
||||||
<th >Amount</th>
|
<th>Block #</th>
|
||||||
|
<th>Amount</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody style="font-size:12px;">
|
<tbody style="font-size:12px;">
|
||||||
@ -97,7 +98,8 @@
|
|||||||
{else if $TRANSACTIONS[transaction].confirmations == -1}<span class="orphan">Orphaned</span>
|
{else if $TRANSACTIONS[transaction].confirmations == -1}<span class="orphan">Orphaned</span>
|
||||||
{else}<span class="unconfirmed">Unconfirmed</span>{/if}
|
{else}<span class="unconfirmed">Unconfirmed</span>{/if}
|
||||||
</td>
|
</td>
|
||||||
<td>{$TRANSACTIONS[transaction].coin_address}</td>
|
<td>{$TRANSACTIONS[transaction].coin_address|truncate:20:"...":true:true}</td>
|
||||||
|
<td>{$TRANSACTIONS[transaction].txid|truncate:20:"...":true:true}</td>
|
||||||
<td>{if $TRANSACTIONS[transaction].height == 0}n/a{else}<a href="{$smarty.server.PHP_SELF}?page=statistics&action=round&height={$TRANSACTIONS[transaction].height}">{$TRANSACTIONS[transaction].height}</a>{/if}</td>
|
<td>{if $TRANSACTIONS[transaction].height == 0}n/a{else}<a href="{$smarty.server.PHP_SELF}?page=statistics&action=round&height={$TRANSACTIONS[transaction].height}">{$TRANSACTIONS[transaction].height}</a>{/if}</td>
|
||||||
<td><font color="{if $TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Credit_PPS' or $TRANSACTIONS[transaction].type == 'Bonus'}green{else}red{/if}">{$TRANSACTIONS[transaction].amount|number_format:"8"}</td>
|
<td><font color="{if $TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Credit_PPS' or $TRANSACTIONS[transaction].type == 'Bonus'}green{else}red{/if}">{$TRANSACTIONS[transaction].amount|number_format:"8"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -75,14 +75,15 @@
|
|||||||
<table cellspacing="0" class="tablesorter" width="100%">
|
<table cellspacing="0" class="tablesorter" width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="center">TX #</th>
|
<th align="center">ID</th>
|
||||||
<th >Account</th>
|
<th>Account</th>
|
||||||
<th >Date</th>
|
<th>Date</th>
|
||||||
<th >TX Type</th>
|
<th>TX Type</th>
|
||||||
<th align="center">Status</th>
|
<th align="center">Status</th>
|
||||||
<th >Payment Address</th>
|
<th>Payment Address</th>
|
||||||
<th >Block #</th>
|
<th>TX #</th>
|
||||||
<th >Amount</th>
|
<th>Block #</th>
|
||||||
|
<th>Amount</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody style="font-size:12px;">
|
<tbody style="font-size:12px;">
|
||||||
@ -104,7 +105,8 @@
|
|||||||
{else if $TRANSACTIONS[transaction].confirmations == -1}<span class="orphan">Orphaned</span>
|
{else if $TRANSACTIONS[transaction].confirmations == -1}<span class="orphan">Orphaned</span>
|
||||||
{else}<span class="unconfirmed">Unconfirmed</span>{/if}
|
{else}<span class="unconfirmed">Unconfirmed</span>{/if}
|
||||||
</td>
|
</td>
|
||||||
<td>{$TRANSACTIONS[transaction].coin_address}</td>
|
<td>{$TRANSACTIONS[transaction].coin_address|truncate:20:"...":true:true}</td>
|
||||||
|
<td>{$TRANSACTIONS[transaction].txid|truncate:20:"...":true:true}</td>
|
||||||
<td>{if $TRANSACTIONS[transaction].height == 0}n/a{else}<a href="{$smarty.server.PHP_SELF}?page=statistics&action=round&height={$TRANSACTIONS[transaction].height}">{/if}{$TRANSACTIONS[transaction].height}</a></td>
|
<td>{if $TRANSACTIONS[transaction].height == 0}n/a{else}<a href="{$smarty.server.PHP_SELF}?page=statistics&action=round&height={$TRANSACTIONS[transaction].height}">{/if}{$TRANSACTIONS[transaction].height}</a></td>
|
||||||
<td><font color="{if $TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Credit_PPS' or $TRANSACTIONS[transaction].type == 'Bonus'}green{else}red{/if}">{$TRANSACTIONS[transaction].amount|number_format:"8"}</td>
|
<td><font color="{if $TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Credit_PPS' or $TRANSACTIONS[transaction].type == 'Bonus'}green{else}red{/if}">{$TRANSACTIONS[transaction].amount|number_format:"8"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
1
sql/006_txid_transactions.sql
Normal file
1
sql/006_txid_transactions.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE `transactions` ADD `txid` VARCHAR( 256 ) NULL DEFAULT NULL AFTER `timestamp` ;
|
||||||
Loading…
Reference in New Issue
Block a user