precompute block fee spans
This commit is contained in:
parent
bb61ff97fa
commit
ee39283241
@ -121,7 +121,7 @@
|
|||||||
<ng-container *ngIf="!isLoadingBlock; else loadingRest">
|
<ng-container *ngIf="!isLoadingBlock; else loadingRest">
|
||||||
<tr *ngIf="network !== 'liquid' && network !== 'liquidtestnet'">
|
<tr *ngIf="network !== 'liquid' && network !== 'liquidtestnet'">
|
||||||
<td i18n="mempool-block.fee-span">Fee span</td>
|
<td i18n="mempool-block.fee-span">Fee span</td>
|
||||||
<td><span>{{ getMinBlockFee(block) | number:'1.0-0' }} - {{ getMaxBlockFee(block) | number:'1.0-0' }} <span class="symbol" i18n="shared.sat-vbyte|sat/vB">sat/vB</span></span></td>
|
<td><span>{{ block?.extras?.minFee | number:'1.0-0' }} - {{ block?.extras?.maxFee | number:'1.0-0' }} <span class="symbol" i18n="shared.sat-vbyte|sat/vB">sat/vB</span></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr *ngIf="block?.extras?.medianFee != undefined">
|
<tr *ngIf="block?.extras?.medianFee != undefined">
|
||||||
<td class="td-width" i18n="block.median-fee">Median fee</td>
|
<td class="td-width" i18n="block.median-fee">Median fee</td>
|
||||||
|
@ -138,6 +138,8 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
if (block.id === this.blockHash) {
|
if (block.id === this.blockHash) {
|
||||||
this.block = block;
|
this.block = block;
|
||||||
|
block.extras.minFee = this.getMinBlockFee(block);
|
||||||
|
block.extras.maxFee = this.getMaxBlockFee(block);
|
||||||
if (block?.extras?.reward != undefined) {
|
if (block?.extras?.reward != undefined) {
|
||||||
this.fees = block.extras.reward / 100000000 - this.blockSubsidy;
|
this.fees = block.extras.reward / 100000000 - this.blockSubsidy;
|
||||||
}
|
}
|
||||||
@ -234,6 +236,8 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
this.updateAuditAvailableFromBlockHeight(block.height);
|
this.updateAuditAvailableFromBlockHeight(block.height);
|
||||||
this.block = block;
|
this.block = block;
|
||||||
|
block.extras.minFee = this.getMinBlockFee(block);
|
||||||
|
block.extras.maxFee = this.getMaxBlockFee(block);
|
||||||
this.blockHeight = block.height;
|
this.blockHeight = block.height;
|
||||||
this.lastBlockHeight = this.blockHeight;
|
this.lastBlockHeight = this.blockHeight;
|
||||||
this.nextBlockHeight = block.height + 1;
|
this.nextBlockHeight = block.height + 1;
|
||||||
|
@ -31,9 +31,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<div [attr.data-cy]="'bitcoin-block-' + offset + '-index-' + i + '-fee-span'" class="fee-span"
|
<div [attr.data-cy]="'bitcoin-block-' + offset + '-index-' + i + '-fee-span'" class="fee-span"
|
||||||
*ngIf="block?.extras?.feeRange; else emptyfeespan">
|
*ngIf="block?.extras?.minFee != null && block?.extras?.maxFee != null; else emptyfeespan">
|
||||||
{{ getMinBlockFee(block) | number:feeRounding }} - {{
|
{{ block.extras.minFee | number:feeRounding }} - {{ block.extras.maxFee | number:feeRounding }} <ng-container
|
||||||
getMaxBlockFee(block) | number:feeRounding }} <ng-container
|
|
||||||
i18n="shared.sat-vbyte|sat/vB">sat/vB</ng-container>
|
i18n="shared.sat-vbyte|sat/vB">sat/vB</ng-container>
|
||||||
</div>
|
</div>
|
||||||
<ng-template #emptyfeespan>
|
<ng-template #emptyfeespan>
|
||||||
|
@ -113,6 +113,9 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.blocksFilled = false;
|
this.blocksFilled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
block.extras.minFee = this.getMinBlockFee(block);
|
||||||
|
block.extras.maxFee = this.getMaxBlockFee(block);
|
||||||
|
|
||||||
this.blocks.unshift(block);
|
this.blocks.unshift(block);
|
||||||
this.blocks = this.blocks.slice(0, this.dynamicBlocksAmount);
|
this.blocks = this.blocks.slice(0, this.dynamicBlocksAmount);
|
||||||
|
|
||||||
@ -239,6 +242,10 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
if (height >= 0) {
|
if (height >= 0) {
|
||||||
this.cacheService.loadBlock(height);
|
this.cacheService.loadBlock(height);
|
||||||
block = this.cacheService.getCachedBlock(height) || null;
|
block = this.cacheService.getCachedBlock(height) || null;
|
||||||
|
if (block) {
|
||||||
|
block.extras.minFee = this.getMinBlockFee(block);
|
||||||
|
block.extras.maxFee = this.getMaxBlockFee(block);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.blocks.push(block || {
|
this.blocks.push(block || {
|
||||||
placeholder: height < 0,
|
placeholder: height < 0,
|
||||||
@ -277,6 +284,8 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
onBlockLoaded(block: BlockExtended) {
|
onBlockLoaded(block: BlockExtended) {
|
||||||
const blockIndex = this.height - block.height;
|
const blockIndex = this.height - block.height;
|
||||||
if (blockIndex >= 0 && blockIndex < this.blocks.length) {
|
if (blockIndex >= 0 && blockIndex < this.blocks.length) {
|
||||||
|
block.extras.minFee = this.getMinBlockFee(block);
|
||||||
|
block.extras.maxFee = this.getMaxBlockFee(block);
|
||||||
this.blocks[blockIndex] = block;
|
this.blocks[blockIndex] = block;
|
||||||
this.blockStyles[blockIndex] = this.getStyleForBlock(block, blockIndex);
|
this.blockStyles[blockIndex] = this.getStyleForBlock(block, blockIndex);
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,8 @@ export interface PoolStat {
|
|||||||
export interface BlockExtension {
|
export interface BlockExtension {
|
||||||
totalFees?: number;
|
totalFees?: number;
|
||||||
medianFee?: number;
|
medianFee?: number;
|
||||||
|
minFee?: number;
|
||||||
|
maxFee?: number;
|
||||||
feeRange?: number[];
|
feeRange?: number[];
|
||||||
reward?: number;
|
reward?: number;
|
||||||
coinbaseRaw?: string;
|
coinbaseRaw?: string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user