Renamed extra to extras

This commit is contained in:
nymkappa 2022-02-04 19:28:00 +09:00
parent 9f0b09295d
commit 456bd5a18e
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
11 changed files with 31 additions and 31 deletions

View File

@ -97,7 +97,7 @@ class Blocks {
private getBlockExtended(block: IEsploraApi.Block, transactions: TransactionExtended[]): BlockExtended {
const blockExtended: BlockExtended = Object.assign({}, block);
blockExtended.extra = {
blockExtended.extras = {
reward: transactions[0].vout.reduce((acc, curr) => acc + curr.value, 0),
coinbaseTx: transactionUtils.stripCoinbaseTransaction(transactions[0]),
};
@ -106,9 +106,9 @@ class Blocks {
transactionsTmp.shift();
transactionsTmp.sort((a, b) => b.effectiveFeePerVsize - a.effectiveFeePerVsize);
blockExtended.extra.medianFee = transactionsTmp.length > 0 ?
blockExtended.extras.medianFee = transactionsTmp.length > 0 ?
Common.median(transactionsTmp.map((tx) => tx.effectiveFeePerVsize)) : 0;
blockExtended.extra.feeRange = transactionsTmp.length > 0 ?
blockExtended.extras.feeRange = transactionsTmp.length > 0 ?
Common.getFeesInRange(transactionsTmp, 8) : [0, 0];
return blockExtended;
@ -205,8 +205,8 @@ class Blocks {
const blockExtended = this.getBlockExtended(block, transactions);
let miner: PoolTag;
if (blockExtended?.extra?.coinbaseTx) {
miner = await this.$findBlockMiner(blockExtended.extra.coinbaseTx);
if (blockExtended?.extras?.coinbaseTx) {
miner = await this.$findBlockMiner(blockExtended.extras.coinbaseTx);
} else {
miner = await poolsRepository.$getUnknownPool();
}
@ -276,8 +276,8 @@ class Blocks {
if (['mainnet', 'testnet', 'signet'].includes(config.MEMPOOL.NETWORK) === true) {
let miner: PoolTag;
if (blockExtended?.extra?.coinbaseTx) {
miner = await this.$findBlockMiner(blockExtended.extra.coinbaseTx);
if (blockExtended?.extras?.coinbaseTx) {
miner = await this.$findBlockMiner(blockExtended.extras.coinbaseTx);
} else {
miner = await poolsRepository.$getUnknownPool();
}

View File

@ -380,8 +380,8 @@ class WebsocketHandler {
mBlocks = mempoolBlocks.getMempoolBlocks();
}
if (block.extra) {
block.extra.matchRate = matchRate;
if (block.extras) {
block.extras.matchRate = matchRate;
}
this.wss.clients.forEach((client) => {

View File

@ -86,7 +86,7 @@ export interface BlockExtension {
}
export interface BlockExtended extends IEsploraApi.Block {
extra?: BlockExtension;
extras?: BlockExtension;
}
export interface TransactionMinerInfo {

View File

@ -42,7 +42,7 @@ class BlocksRepository {
poolTag.id,
0,
'[]',
block.extra ? block.extra.medianFee : 0,
block.extras ? block.extras.medianFee : 0,
];
await connection.query(query, params);

View File

@ -74,9 +74,9 @@
<div class="col-sm">
<table class="table table-borderless table-striped">
<tbody>
<tr *ngIf="block?.extra?.medianFee != undefined">
<tr *ngIf="block?.extras?.medianFee != undefined">
<td class="td-width" i18n="block.median-fee">Median fee</td>
<td>~{{ block?.extra?.medianFee | number:'1.0-0' }} <span class="symbol" i18n="shared.sat-vbyte|sat/vB">sat/vB</span> <span class="fiat"><app-fiat [value]="block?.extra?.medianFee * 140" digitsInfo="1.2-2" i18n-ngbTooltip="Transaction fee tooltip" ngbTooltip="Based on average native segwit transaction of 140 vBytes" placement="bottom"></app-fiat></span></td>
<td>~{{ block?.extras?.medianFee | number:'1.0-0' }} <span class="symbol" i18n="shared.sat-vbyte|sat/vB">sat/vB</span> <span class="fiat"><app-fiat [value]="block?.extras?.medianFee * 140" digitsInfo="1.2-2" i18n-ngbTooltip="Transaction fee tooltip" ngbTooltip="Based on average native segwit transaction of 140 vBytes" placement="bottom"></app-fiat></span></td>
</tr>
<ng-template [ngIf]="fees !== undefined" [ngIfElse]="loadingFees">
<tr>

View File

@ -77,8 +77,8 @@ export class BlockComponent implements OnInit, OnDestroy {
if (block.id === this.blockHash) {
this.block = block;
if (block?.extra?.reward != undefined) {
this.fees = block.extra.reward / 100000000 - this.blockSubsidy;
if (block?.extras?.reward != undefined) {
this.fees = block.extras.reward / 100000000 - this.blockSubsidy;
}
}
});
@ -145,10 +145,10 @@ export class BlockComponent implements OnInit, OnDestroy {
this.seoService.setTitle($localize`:@@block.component.browser-title:Block ${block.height}:BLOCK_HEIGHT:: ${block.id}:BLOCK_ID:`);
this.isLoadingBlock = false;
this.coinbaseTx = block?.extra?.coinbaseTx;
this.coinbaseTx = block?.extras?.coinbaseTx;
this.setBlockSubsidy();
if (block?.extra?.reward !== undefined) {
this.fees = block.extra.reward / 100000000 - this.blockSubsidy;
if (block?.extras?.reward !== undefined) {
this.fees = block.extras.reward / 100000000 - this.blockSubsidy;
}
this.stateService.markBlock$.next({ blockHeight: this.blockHeight });
this.isLoadingTransactions = true;

View File

@ -8,10 +8,10 @@
</div>
<div class="block-body">
<div class="fees">
~{{ block?.extra?.medianFee | number:feeRounding }} <ng-container i18n="shared.sat-vbyte|sat/vB">sat/vB</ng-container>
~{{ block?.extras?.medianFee | number:feeRounding }} <ng-container i18n="shared.sat-vbyte|sat/vB">sat/vB</ng-container>
</div>
<div class="fee-span">
{{ block?.extra?.feeRange[1] | number:feeRounding }} - {{ block?.extra?.feeRange[block?.extra?.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 class="block-size" [innerHTML]="'&lrm;' + (block.size | bytes: 2)"></div>
<div class="transaction-count">

View File

@ -69,8 +69,8 @@ export class BlockchainBlocksComponent implements OnInit, OnDestroy {
this.blocks.unshift(block);
this.blocks = this.blocks.slice(0, this.stateService.env.KEEP_BLOCKS_AMOUNT);
if (this.blocksFilled && !this.tabHidden && block.extra) {
block.extra.stage = block.extra.matchRate >= 66 ? 1 : 2;
if (this.blocksFilled && !this.tabHidden && block.extras) {
block.extras.stage = block.extras.matchRate >= 66 ? 1 : 2;
}
if (txConfirmed) {
@ -151,8 +151,8 @@ export class BlockchainBlocksComponent implements OnInit, OnDestroy {
const greenBackgroundHeight = 100 - (block.weight / this.stateService.env.BLOCK_WEIGHT_UNITS) * 100;
let addLeft = 0;
if (block?.extra?.stage === 1) {
block.extra.stage = 2;
if (block?.extras?.stage === 1) {
block.extras.stage = 2;
addLeft = -205;
}
@ -170,8 +170,8 @@ export class BlockchainBlocksComponent implements OnInit, OnDestroy {
getStyleForEmptyBlock(block: BlockExtended) {
let addLeft = 0;
if (block?.extra?.stage === 1) {
block.extra.stage = 2;
if (block?.extras?.stage === 1) {
block.extras.stage = 2;
addLeft = -205;
}

View File

@ -153,7 +153,7 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
this.blockSubscription = this.stateService.blocks$
.subscribe(([block]) => {
if (block?.extra?.matchRate >= 66 && !this.tabHidden) {
if (block?.extras?.matchRate >= 66 && !this.tabHidden) {
this.blockIndex++;
}
});

View File

@ -29,7 +29,7 @@ export class TxFeeRatingComponent implements OnInit, OnChanges, OnDestroy {
ngOnInit() {
this.blocksSubscription = this.stateService.blocks$.subscribe(([block]) => {
this.blocks.push(block);
if (this.tx.status.confirmed && this.tx.status.block_height === block.height && block?.extra?.medianFee > 0) {
if (this.tx.status.confirmed && this.tx.status.block_height === block.height && block?.extras?.medianFee > 0) {
this.calculateRatings(block);
this.cd.markForCheck();
}
@ -43,7 +43,7 @@ export class TxFeeRatingComponent implements OnInit, OnChanges, OnDestroy {
}
const foundBlock = this.blocks.find((b) => b.height === this.tx.status.block_height);
if (foundBlock && foundBlock?.extra?.medianFee > 0) {
if (foundBlock && foundBlock?.extras?.medianFee > 0) {
this.calculateRatings(foundBlock);
}
}
@ -54,7 +54,7 @@ export class TxFeeRatingComponent implements OnInit, OnChanges, OnDestroy {
calculateRatings(block: BlockExtended) {
const feePervByte = this.tx.effectiveFeePerVsize || this.tx.fee / (this.tx.weight / 4);
this.medianFeeNeeded = block?.extra?.medianFee;
this.medianFeeNeeded = block?.extras?.medianFee;
// Block not filled
if (block.weight < this.stateService.env.BLOCK_WEIGHT_UNITS * 0.95) {

View File

@ -93,6 +93,6 @@ export interface BlockExtension {
}
export interface BlockExtended extends Block {
extra?: BlockExtension;
extras?: BlockExtension;
}