Use BLOCK_WEIGHT_UNITS instead of hard coded block size limit in all occations.

This commit is contained in:
softsimon 2021-08-08 04:19:54 +03:00
parent c6b1979391
commit 7ef4be26ed
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
5 changed files with 5 additions and 5 deletions

View File

@ -169,7 +169,7 @@ export class BlockchainBlocksComponent implements OnInit, OnDestroy {
}
getStyleForBlock(block: Block) {
const greenBackgroundHeight = 100 - (block.weight / 4000000) * 100;
const greenBackgroundHeight = 100 - (block.weight / this.stateService.env.BLOCK_WEIGHT_UNITS) * 100;
let addLeft = 0;
if (block.stage === 1) {

View File

@ -20,7 +20,7 @@
<td class="d-none d-lg-block">{{ block.tx_count | number }}</td>
<td>
<div class="progress">
<div class="progress-bar progress-mempool {{ network$ | async }}" role="progressbar" [ngStyle]="{'width': (block.weight / 4000000)*100 + '%' }"></div>
<div class="progress-bar progress-mempool {{ network$ | async }}" role="progressbar" [ngStyle]="{'width': (block.weight / stateService.env.BLOCK_WEIGHT_UNITS)*100 + '%' }"></div>
<div class="progress-text" [innerHTML]="block.size | bytes: 2"></div>
</div>
</td>

View File

@ -29,7 +29,7 @@ export class LatestBlocksComponent implements OnInit, OnDestroy {
constructor(
private electrsApiService: ElectrsApiService,
private stateService: StateService,
public stateService: StateService,
private seoService: SeoService,
private websocketService: WebsocketService,
private cd: ChangeDetectorRef,

View File

@ -56,7 +56,7 @@ export class TxFeeRatingComponent implements OnInit, OnChanges, OnDestroy {
this.medianFeeNeeded = block.medianFee;
// Block not filled
if (block.weight < 4000000 * 0.95) {
if (block.weight < this.stateService.env.BLOCK_WEIGHT_UNITS * 0.95) {
this.medianFeeNeeded = 1;
}

View File

@ -88,7 +88,7 @@
<td class="table-cell-transaction-count">{{ block.tx_count | number }}</td>
<td class="table-cell-size">
<div class="progress">
<div class="progress-bar progress-mempool {{ network$ | async }}" role="progressbar" [ngStyle]="{'width': (block.weight / 4000000)*100 + '%' }">&nbsp;</div>
<div class="progress-bar progress-mempool {{ network$ | async }}" role="progressbar" [ngStyle]="{'width': (block.weight / stateService.env.BLOCK_WEIGHT_UNITS)*100 + '%' }">&nbsp;</div>
<div class="progress-text" [innerHTML]="block.size | bytes: 2"></div>
</div>
</td>