Liquid gets block reward data from coinbase
This commit is contained in:
@@ -19,6 +19,7 @@ export class BlockTransactionsComponent implements OnInit {
|
||||
@Input() previousBlockHash: string;
|
||||
@Input() block$: Observable<any>;
|
||||
@Input() paginationMaxSize: number;
|
||||
@Output() blockReward = new EventEmitter<number>();
|
||||
|
||||
itemsPerPage = this.stateService.env.ITEMS_PER_PAGE;
|
||||
page = 1;
|
||||
@@ -50,6 +51,13 @@ export class BlockTransactionsComponent implements OnInit {
|
||||
return of([]);
|
||||
}))
|
||||
),
|
||||
tap((transactions: Transaction[]) => {
|
||||
// The block API doesn't contain the block rewards on Liquid
|
||||
if (this.stateService.isLiquid() && transactions && transactions[0] && transactions[0].vin[0].is_coinbase) {
|
||||
const blockReward = transactions[0].vout.reduce((acc: number, curr: Vout) => acc + curr.value, 0) / 100000000;
|
||||
this.blockReward.emit(blockReward);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
this.txsLoadingStatus$ = this.route.paramMap
|
||||
|
||||
Reference in New Issue
Block a user