Skip to content

Commit

Permalink
Don't hydrate if block is null. Avoid 404 from API.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tate Peñaranda committed Sep 7, 2018
1 parent 58304a7 commit 7cf0f55
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Models/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ protected function addAmountTransactedToWalletSatoshiAttribute()
}

return Cache::rememberForever("tpenaranda-bcoin:amount-in-satoshi-transacted-tx_hash:{$this->hash}-wallet_id:{$this->wallet_id}", function () {
if (empty($this->inputs[0]->coin) || empty($transaction->fee)) {
$this->hydrate($this->getDataFromBlockchain());
}

if (empty($this->block)) {
return null;
}

if (empty($this->inputs[0]->coin) || empty($transaction->fee)) {
$this->hydrate($this->getDataFromBlockchain());
}

$total_inputs_own_wallet = $total_outputs_own_wallet = 0;

foreach ($this->inputs as $input) {
Expand Down

0 comments on commit 7cf0f55

Please sign in to comment.