From 94682cc4d428d3dd56933a59604793bcdd5377db Mon Sep 17 00:00:00 2001 From: marcdeb1 Date: Mon, 17 Dec 2018 12:35:54 +0100 Subject: [PATCH] Fixed transaction value issue --- src/Controller/MainController.php | 7 +++++-- src/Template/Main/blocks.ctp | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index f144f0c..fdf30bb 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -381,6 +381,8 @@ class MainController extends AppController { public function blocks($height = null) { $this->loadModel('Blocks'); + $this->loadModel('Outputs'); + $this->loadModel('Transactions'); if ($height === null) { // paginate blocks @@ -413,7 +415,6 @@ class MainController extends AppController { $this->set('numRecords', $numBlocks); $this->set('currentPage', $page); } else { - $this->loadModel('Transactions'); $height = intval($height); if ($height < 0) { return $this->redirect('/'); @@ -425,7 +426,8 @@ class MainController extends AppController { } // Get the basic block transaction info - $txs = $this->Transactions->find()->select(['input_count', 'output_count', 'hash', 'version'])->where(['block_hash_id' => $block->hash])->toArray(); + $txs = $this->Transactions->find()->select(['id', 'input_count', 'output_count', 'hash', 'version'])->where(['block_hash_id' => $block->hash])->toArray(); + $this->set('block', $block); $this->set('blockTxs', $txs); @@ -444,6 +446,7 @@ class MainController extends AppController { $tx = $this->Transactions->find()->select( ['id', 'block_hash_id', 'input_count', 'output_count', 'hash', 'transaction_time', 'transaction_size', 'created_at', 'version', 'lock_time', 'raw'])->where(['hash' => $hash])->first(); + $tx->value = $tx->value(); if (!$tx) { return $this->redirect('/'); } diff --git a/src/Template/Main/blocks.ctp b/src/Template/Main/blocks.ctp index 3c1512f..9c8fb17 100644 --- a/src/Template/Main/blocks.ctp +++ b/src/Template/Main/blocks.ctp @@ -29,13 +29,11 @@
- previous_block_hash)) > 0): ?> + height > 0): ?> « Previous Block - next_block_hash)) > 0): ?> Next Block » -