mirror of
https://github.com/mempool/mempool.git
synced 2025-04-02 08:58:17 +02:00
Liquid gets block reward data from coinbase
This commit is contained in:
parent
aa80fa550b
commit
ea0a4d1d67
@ -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
|
||||
|
@ -326,7 +326,7 @@
|
||||
</div>
|
||||
|
||||
@defer (on viewport) {
|
||||
<app-block-transactions [paginationMaxSize]="paginationMaxSize" [block$]="block$" [txCount]="block.tx_count" [timestamp]="block.timestamp" [blockHash]="blockHash" [previousBlockHash]="block.previousblockhash"></app-block-transactions>
|
||||
<app-block-transactions [paginationMaxSize]="paginationMaxSize" [block$]="block$" [txCount]="block.tx_count" [timestamp]="block.timestamp" [blockHash]="blockHash" [previousBlockHash]="block.previousblockhash" (blockReward)="updateBlockReward($event)"></app-block-transactions>
|
||||
} @placeholder {
|
||||
<div>
|
||||
<div class="block-tx-title">
|
||||
|
@ -755,4 +755,10 @@ export class BlockComponent implements OnInit, OnDestroy {
|
||||
this.block.canonical = block.id;
|
||||
}
|
||||
}
|
||||
|
||||
updateBlockReward(blockReward: number): void {
|
||||
if (this.fees === undefined) {
|
||||
this.fees = blockReward;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user