Merge pull request #59 from marcdeb1/confirmations_fix
Confirmations fix
This commit is contained in:
commit
6054ddc6c0
4 changed files with 14 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@
|
||||||
lbryexplorer.zip
|
lbryexplorer.zip
|
||||||
lbryexplorer.komodoproject
|
lbryexplorer.komodoproject
|
||||||
.komodotools
|
.komodotools
|
||||||
|
/.gtm/
|
||||||
|
|
|
@ -328,8 +328,11 @@ class MainController extends AppController {
|
||||||
|
|
||||||
// Get the basic block transaction info
|
// 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();
|
$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('block', $block);
|
||||||
$this->set('blockTxs', $txs);
|
$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();
|
$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();
|
$inputs = $this->Inputs->find()->where(['transaction_id' => $tx->id])->order(['prevout_n' => 'asc'])->toArray();
|
||||||
foreach($inputs as $input) {
|
foreach($inputs as $input) {
|
||||||
$inputAddresses = $this->Addresses->find()->select(['id', 'address'])->where(['id' => $input->input_address_id])->toArray();
|
$inputAddresses = $this->Addresses->find()->select(['id', 'address'])->where(['id' => $input->input_address_id])->toArray();
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<div class="label half-width">Confirmations</div>
|
<div class="label half-width">Confirmations</div>
|
||||||
|
|
||||||
<div class="value half-width"><?php echo $block->bits ?></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>
|
<div class="clear spacer"></div>
|
||||||
|
|
||||||
|
|
|
@ -187,14 +187,6 @@
|
||||||
foreach ($recentClaims as $claim):
|
foreach ($recentClaims as $claim):
|
||||||
$idx++;
|
$idx++;
|
||||||
$autoThumbText = $claim->getAutoThumbText();
|
$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
|
// content type
|
||||||
$ctTag = $claim->getContentTag();
|
$ctTag = $claim->getContentTag();
|
||||||
|
@ -219,7 +211,7 @@
|
||||||
|
|
||||||
<div class="metadata">
|
<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="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>
|
<div class="clear"></div>
|
||||||
<?php if ($claim->claim_type == 2 && strlen(trim($claim->description)) > 0): ?>
|
<?php if ($claim->claim_type == 2 && strlen(trim($claim->description)) > 0): ?>
|
||||||
|
|
Loading…
Reference in a new issue