Bufix: Miner started reloading when switching transaction page

This commit is contained in:
softsimon 2020-07-20 10:29:38 +07:00
parent eac605f181
commit 5e16c592cb
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
2 changed files with 9 additions and 1 deletions

View File

@ -69,7 +69,7 @@
</ng-template>
<tr>
<td>Miner</td>
<td><app-miner [coinbaseTransaction]="block.coinbaseTx || (transactions && transactions[0])"></app-miner></td>
<td><app-miner [coinbaseTransaction]="coinbaseTx"></app-miner></td>
</tr>
</tbody>
</table>

View File

@ -28,6 +28,7 @@ export class BlockComponent implements OnInit, OnDestroy {
subscription: Subscription;
fees: number;
paginationMaxSize: number;
coinbaseTx: Transaction;
page = 1;
itemsPerPage = env.ELCTRS_ITEMS_PER_PAGE;
@ -50,6 +51,7 @@ export class BlockComponent implements OnInit, OnDestroy {
const blockHash: string = params.get('id') || '';
this.block = undefined;
this.page = 1;
this.coinbaseTx = undefined;
this.error = undefined;
this.fees = undefined;
this.stateService.markBlock$.next({});
@ -92,6 +94,9 @@ export class BlockComponent implements OnInit, OnDestroy {
this.blockHeight = block.height;
this.seoService.setTitle('Block: #' + block.height + ': ' + block.id, true);
this.isLoadingBlock = false;
if (block.coinbaseTx) {
this.coinbaseTx = block.coinbaseTx;
}
this.setBlockSubsidy();
if (block.reward) {
this.fees = block.reward / 100000000 - this.blockSubsidy;
@ -113,6 +118,9 @@ export class BlockComponent implements OnInit, OnDestroy {
if (this.fees === undefined && transactions[0]) {
this.fees = transactions[0].vout.reduce((acc: number, curr: Vout) => acc + curr.value, 0) / 100000000 - this.blockSubsidy;
}
if (!this.coinbaseTx && transactions[0]) {
this.coinbaseTx = transactions[0];
}
this.transactions = transactions;
this.isLoadingTransactions = false;
},