From 7cf0f550b0ea372ff2d63282b6b723bb8d79dfd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tate=20Pe=C3=B1aranda?= Date: Fri, 7 Sep 2018 12:53:42 -0300 Subject: [PATCH] Don't hydrate if block is null. Avoid 404 from API. --- src/Models/Transaction.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Models/Transaction.php b/src/Models/Transaction.php index 563e72a..cc53831 100644 --- a/src/Models/Transaction.php +++ b/src/Models/Transaction.php @@ -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) {