[ADDED] TXID on debit transactions
This commit is contained in:
parent
3094681018
commit
232dd76af5
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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';
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user