Confirmations fix #59

Merged
marcdeb1 merged 4 commits from confirmations_fix into master 2019-03-26 22:32:11 +01:00
4 changed files with 14 additions and 11 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@
lbryexplorer.zip
lbryexplorer.komodoproject
.komodotools
/.gtm/

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,14 @@ class MainController extends AppController {
}
$block = $this->Blocks->find()->select(['confirmations', 'height'])->where(['hash' => $tx->block_hash_id])->first();
$confirmations = $block->confirmations;
$confirmations = 0;
if($tx->block_hash_id == 'MEMPOOL') {
$confirmations = 0;
}
else {
$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>

View file

@ -187,14 +187,6 @@
foreach ($recentClaims as $claim):
$idx++;
$autoThumbText = $claim->getAutoThumbText();
$link = $claim->name;
$rawLink = $claim->name;
if (isset($claim->publisher)) {
$link = urlencode($claim->publisher) . '/' . $link;
$rawLink = $claim->publisher . '/' . $link;
}
$link = 'lbry://' . $link;
$rawLink = 'lbry://' . $rawLink;
// content type
$ctTag = $claim->getContentTag();
@ -219,7 +211,7 @@
<div class="metadata">
<div class="title" title="<?php echo $claim->claim_type == 1 ? $claim->name : ((strlen(trim($claim->title)) > 0) ? $claim->title : ''); ?>"><?php echo $claim->claim_type == 1 ? $claim->name : ((strlen(trim($claim->title)) > 0) ? $claim->title : '<em>No Title</em>') ?></div>
<div class="link" title="<?php echo $rawLink ?>"><a href="<?php echo $link ?>"><?php echo $rawLink ?></a></div>
<div class="link" title="<?php echo $claim->getLbryLink() ?>"><a href="<?php echo $claim->getLbryLink() ?>"><?php echo $claim->getLbryLink() ?></a></div>
<div class="clear"></div>
<?php if ($claim->claim_type == 2 && strlen(trim($claim->description)) > 0): ?>