Confirmations fix #59

Merged
marcdeb1 merged 4 commits from confirmations_fix into master 2019-03-26 22:32:11 +01:00
2 changed files with 6 additions and 2 deletions
Showing only changes of commit 5c5c7924af - Show all commits

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>