Merge pull request #1277 from nymkappa/feature/mempool-show-only-fees
Remove block subsidy from mempool blocks
This commit is contained in:
commit
c52f1c6973
@ -116,6 +116,9 @@ class Blocks {
|
|||||||
Common.median(transactionsTmp.map((tx) => tx.effectiveFeePerVsize)) : 0;
|
Common.median(transactionsTmp.map((tx) => tx.effectiveFeePerVsize)) : 0;
|
||||||
blockExtended.extras.feeRange = transactionsTmp.length > 0 ?
|
blockExtended.extras.feeRange = transactionsTmp.length > 0 ?
|
||||||
Common.getFeesInRange(transactionsTmp, 8) : [0, 0];
|
Common.getFeesInRange(transactionsTmp, 8) : [0, 0];
|
||||||
|
blockExtended.extras.totalFees = transactionsTmp.reduce((acc, tx) => {
|
||||||
|
return acc + tx.fee;
|
||||||
|
}, 0)
|
||||||
|
|
||||||
if (Common.indexingEnabled()) {
|
if (Common.indexingEnabled()) {
|
||||||
let pool: PoolTag;
|
let pool: PoolTag;
|
||||||
|
@ -78,6 +78,7 @@ export interface TransactionStripped {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface BlockExtension {
|
export interface BlockExtension {
|
||||||
|
totalFees?: number;
|
||||||
medianFee?: number;
|
medianFee?: number;
|
||||||
feeRange?: number[];
|
feeRange?: number[];
|
||||||
reward?: number;
|
reward?: number;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
{{ block?.extras?.feeRange[1] | number:feeRounding }} - {{ block?.extras?.feeRange[block?.extras?.feeRange.length - 1] | number:feeRounding }} <ng-container i18n="shared.sat-vbyte|sat/vB">sat/vB</ng-container>
|
{{ block?.extras?.feeRange[1] | number:feeRounding }} - {{ block?.extras?.feeRange[block?.extras?.feeRange.length - 1] | number:feeRounding }} <ng-container i18n="shared.sat-vbyte|sat/vB">sat/vB</ng-container>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="showMiningInfo" class="block-size">
|
<div *ngIf="showMiningInfo" class="block-size">
|
||||||
<app-amount [satoshis]="block.extras.reward" digitsInfo="1.2-2" [noFiat]="true"></app-amount>
|
<app-amount [satoshis]="block.extras?.totalFees ?? 0" digitsInfo="1.2-3" [noFiat]="true"></app-amount>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!showMiningInfo" class="block-size" [innerHTML]="'‎' + (block.size | bytes: 2)"></div>
|
<div *ngIf="!showMiningInfo" class="block-size" [innerHTML]="'‎' + (block.size | bytes: 2)"></div>
|
||||||
<div class="transaction-count">
|
<div class="transaction-count">
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
{{ projectedBlock.feeRange[0] | number:feeRounding }} - {{ projectedBlock.feeRange[projectedBlock.feeRange.length - 1] | number:feeRounding }} <span i18n="shared.sat-vbyte|sat/vB">sat/vB</span>
|
{{ projectedBlock.feeRange[0] | number:feeRounding }} - {{ projectedBlock.feeRange[projectedBlock.feeRange.length - 1] | number:feeRounding }} <span i18n="shared.sat-vbyte|sat/vB">sat/vB</span>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="showMiningInfo" class="block-size">
|
<div *ngIf="showMiningInfo" class="block-size">
|
||||||
<app-amount [satoshis]="projectedBlock.totalFees + blockSubsidy * 100000000" digitsInfo="1.2-2" [noFiat]="true"></app-amount>
|
<app-amount [satoshis]="projectedBlock.totalFees" digitsInfo="1.2-3" [noFiat]="true"></app-amount>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!showMiningInfo" class="block-size" [innerHTML]="'‎' + (projectedBlock.blockSize | bytes: 2)"></div>
|
<div *ngIf="!showMiningInfo" class="block-size" [innerHTML]="'‎' + (projectedBlock.blockSize | bytes: 2)"></div>
|
||||||
<div class="transaction-count">
|
<div class="transaction-count">
|
||||||
|
@ -34,7 +34,6 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
|
|||||||
network = '';
|
network = '';
|
||||||
now = new Date().getTime();
|
now = new Date().getTime();
|
||||||
showMiningInfo = false;
|
showMiningInfo = false;
|
||||||
blockSubsidy = 50;
|
|
||||||
|
|
||||||
blockWidth = 125;
|
blockWidth = 125;
|
||||||
blockPadding = 30;
|
blockPadding = 30;
|
||||||
@ -111,7 +110,6 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
|
|||||||
if (this.stateService.network === '') {
|
if (this.stateService.network === '') {
|
||||||
block.blink = specialBlocks[block.height] ? true : false;
|
block.blink = specialBlocks[block.height] ? true : false;
|
||||||
}
|
}
|
||||||
this.setBlockSubsidy(block.height);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const stringifiedBlocks = JSON.stringify(mempoolBlocks);
|
const stringifiedBlocks = JSON.stringify(mempoolBlocks);
|
||||||
@ -212,18 +210,6 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
|
|||||||
return block.index;
|
return block.index;
|
||||||
}
|
}
|
||||||
|
|
||||||
setBlockSubsidy(blockHeight) {
|
|
||||||
if (!['', 'testnet', 'signet'].includes(this.stateService.network)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.blockSubsidy = 50;
|
|
||||||
let halvenings = Math.floor(blockHeight / 210000);
|
|
||||||
while (halvenings > 0) {
|
|
||||||
this.blockSubsidy = this.blockSubsidy / 2;
|
|
||||||
halvenings--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
reduceMempoolBlocksToFitScreen(blocks: MempoolBlock[]): MempoolBlock[] {
|
reduceMempoolBlocksToFitScreen(blocks: MempoolBlock[]): MempoolBlock[] {
|
||||||
const innerWidth = this.stateService.env.BASE_MODULE !== 'liquid' && window.innerWidth <= 767.98 ? window.innerWidth : window.innerWidth / 2;
|
const innerWidth = this.stateService.env.BASE_MODULE !== 'liquid' && window.innerWidth <= 767.98 ? window.innerWidth : window.innerWidth / 2;
|
||||||
const blocksAmount = Math.min(this.stateService.env.MEMPOOL_BLOCKS_AMOUNT, Math.floor(innerWidth / (this.blockWidth + this.blockPadding)));
|
const blocksAmount = Math.min(this.stateService.env.MEMPOOL_BLOCKS_AMOUNT, Math.floor(innerWidth / (this.blockWidth + this.blockPadding)));
|
||||||
|
@ -101,6 +101,7 @@ export interface PoolStat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface BlockExtension {
|
export interface BlockExtension {
|
||||||
|
totalFees?: number;
|
||||||
medianFee?: number;
|
medianFee?: number;
|
||||||
feeRange?: number[];
|
feeRange?: number[];
|
||||||
reward?: number;
|
reward?: number;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user