Fixed transaction value issue

This commit is contained in:
marcdeb1 2018-12-17 12:35:54 +01:00
parent 6e8a651980
commit 94682cc4d4
2 changed files with 6 additions and 5 deletions

View file

@ -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('/');
}

View file

@ -29,13 +29,11 @@
</div>
<div class="block-nav">
<?php if (strlen(trim($block->previous_block_hash)) > 0): ?>
<?php if ($block->height > 0): ?>
<a class="btn btn-prev" href="/blocks/<?php echo ($block->height - 1); ?>">&laquo; Previous Block</a>
<?php endif; ?>
<?php if (strlen(trim($block->next_block_hash)) > 0): ?>
<a class="btn btn-next" href="/blocks/<?php echo ($block->height + 1); ?>">Next Block &raquo;</a>
<?php endif; ?>
<div class="clear"></div>
</div>