Confirmations number fix

This commit is contained in:
marcdeb1 2019-03-25 23:23:08 +01:00
parent b8a685a8dc
commit 5c5c7924af
2 changed files with 6 additions and 2 deletions

View file

@ -328,8 +328,11 @@ class MainController extends AppController {
// Get the basic block transaction info
$txs = $this->Transactions->find()->select(['Transactions.id', 'Transactions.value', 'Transactions.input_count', 'Transactions.output_count', 'Transactions.hash', 'Transactions.version'])->where(['Transactions.block_hash_id' => $block->hash])->toArray();
$last_block = $this->Blocks->find()->select(['height'])->order(['height' => 'desc'])->first();
$confirmations = $last_block->height - $block->height + 1;
$this->set('block', $block);
$this->set('blockTxs', $txs);
$this->set('confirmations', $confirmations);
}
}
@ -349,7 +352,8 @@ class MainController extends AppController {
}
$block = $this->Blocks->find()->select(['confirmations', 'height'])->where(['hash' => $tx->block_hash_id])->first();
$confirmations = $block->confirmations;
$last_block = $this->Blocks->find()->select(['height'])->order(['height' => 'desc'])->first();
$confirmations = $last_block->height - $block->height + 1;
$inputs = $this->Inputs->find()->where(['transaction_id' => $tx->id])->order(['prevout_n' => 'asc'])->toArray();
foreach($inputs as $input) {
$inputAddresses = $this->Addresses->find()->select(['id', 'address'])->where(['id' => $input->input_address_id])->toArray();

View file

@ -54,7 +54,7 @@
<div class="label half-width">Confirmations</div>
<div class="value half-width"><?php echo $block->bits ?></div>
<div class="value half-width"><?php echo number_format($block->confirmations, 0, '', ',') ?></div>
<div class="value half-width"><?php echo $confirmations ?></div>
<div class="clear spacer"></div>