Skip to content

Commit

Permalink
Check if input has 'coin' attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tate Peñaranda committed Sep 10, 2018
1 parent 7cf0f55 commit 22a0786
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Models/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ protected function addAmountTransactedToWalletSatoshiAttribute()
$total_inputs_own_wallet = $total_outputs_own_wallet = 0;

foreach ($this->inputs as $input) {
if (BCoin::addressBelongsToWallet($input->coin->address, $this->wallet_id)) {
if (!empty($input->coin->address) && BCoin::addressBelongsToWallet($input->coin->address, $this->wallet_id)) {
$total_inputs_own_wallet += $input->coin->value;
}
}

foreach ($this->outputs as $output) {
if (BCoin::addressBelongsToWallet($output->address, $this->wallet_id)) {
if (!empty($output->address) && BCoin::addressBelongsToWallet($output->address, $this->wallet_id)) {
$total_outputs_own_wallet += $output->value;
}
}
Expand Down

0 comments on commit 22a0786

Please sign in to comment.