Chainquery integration #49
1 changed files with 5 additions and 2 deletions
|
@ -96,9 +96,12 @@ class MainController extends AppController {
|
||||||
$blocks = $this->Blocks->find()->select(['chainwork', 'confirmations', 'difficulty', 'hash', 'height', 'transaction_hashes', 'block_time', 'block_size'])->order(['height' => 'desc'])->limit(6)->toArray();
|
$blocks = $this->Blocks->find()->select(['chainwork', 'confirmations', 'difficulty', 'hash', 'height', 'transaction_hashes', 'block_time', 'block_size'])->order(['height' => 'desc'])->limit(6)->toArray();
|
||||||
for ($i = 0; $i < count($blocks); $i++) {
|
for ($i = 0; $i < count($blocks); $i++) {
|
||||||
$tx_hashes = json_decode($blocks[$i]->transaction_hashes, true);
|
$tx_hashes = json_decode($blocks[$i]->transaction_hashes, true);
|
||||||
|
if(!empty($tx_hashes)) {
|
||||||
$blocks[$i]->transaction_count = count($tx_hashes);
|
$blocks[$i]->transaction_count = count($tx_hashes);
|
||||||
|
} else {
|
||||||
|
$blocks[$i]->transaction_count = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// hash rate
|
// hash rate
|
||||||
$hashRate = $this->_formatHashRate($this->_gethashrate());
|
$hashRate = $this->_formatHashRate($this->_gethashrate());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue