From a0dac9c35bb981d2815664da2f5004ea98542f61 Mon Sep 17 00:00:00 2001 From: marcdeb1 Date: Tue, 26 Mar 2019 11:04:22 +0100 Subject: [PATCH] Mempool transactions confirmation --- src/Controller/MainController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 4716a7c..0e9a4b6 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -352,8 +352,14 @@ class MainController extends AppController { } $block = $this->Blocks->find()->select(['confirmations', 'height'])->where(['hash' => $tx->block_hash_id])->first(); - $last_block = $this->Blocks->find()->select(['height'])->order(['height' => 'desc'])->first(); - $confirmations = $last_block->height - $block->height + 1; + $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();