Mempool transactions confirmation
This commit is contained in:
parent
5c5c7924af
commit
a0dac9c35b
1 changed files with 8 additions and 2 deletions
|
@ -352,8 +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 = 0;
|
||||||
|
if($tx->block_hash_id == 'MEMPOOL') {
|
||||||
|
$confirmations = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
$last_block = $this->Blocks->find()->select(['height'])->order(['height' => 'desc'])->first();
|
$last_block = $this->Blocks->find()->select(['height'])->order(['height' => 'desc'])->first();
|
||||||
$confirmations = $last_block->height - $block->height + 1;
|
$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();
|
||||||
|
|
Loading…
Reference in a new issue