public function updateAccountBalances($found_addresses, $parsed_tx, $confirmations, $block_seq, Block $block = null) { // don't process this now if pre-processing was necessary for the send notification if ($this->willNeedToPreprocessSendNotification($parsed_tx, $confirmations)) { return; } $sources = $parsed_tx['sources'] ? $parsed_tx['sources'] : []; $destinations = $parsed_tx['destinations'] ? $parsed_tx['destinations'] : []; // determine matched payment addresses foreach ($found_addresses['payment_addresses'] as $payment_address) { // Log::debug("upating account balances for payment address {$payment_address['address']}. txid is {$parsed_tx['txid']}"); $is_source = in_array($payment_address['address'], $sources); $is_destination = in_array($payment_address['address'], $destinations); if ($is_source) { // this address sent something $quantity = $this->buildQuantityForEventType('send', $parsed_tx, $payment_address['address']); AccountHandler::send($payment_address, $quantity, $parsed_tx['asset'], $parsed_tx, $confirmations); } if ($is_destination) { // this address received something // Note that the same address might be both the sender and the receiver $quantity = $this->buildQuantityForEventType('receive', $parsed_tx, $payment_address['address']); AccountHandler::receive($payment_address, $quantity, $parsed_tx['asset'], $parsed_tx, $confirmations); } } }