Merge pull request #3842 from mempool/mononaut/consistent-fee-ranges
Fix fee range inconsistencies
This commit is contained in:
commit
d955dbff55
@ -681,9 +681,12 @@ class Blocks {
|
|||||||
logger.info(`Re-indexed 10 blocks and summaries. Also re-indexed the last difficulty adjustments. Will re-index latest hashrates in a few seconds.`, logger.tags.mining);
|
logger.info(`Re-indexed 10 blocks and summaries. Also re-indexed the last difficulty adjustments. Will re-index latest hashrates in a few seconds.`, logger.tags.mining);
|
||||||
indexer.reindex();
|
indexer.reindex();
|
||||||
}
|
}
|
||||||
await blocksRepository.$saveBlockInDatabase(blockExtended);
|
}
|
||||||
this.updateTimerProgress(timer, `saved ${this.currentBlockHeight} to database`);
|
|
||||||
|
|
||||||
|
await blocksRepository.$saveBlockInDatabase(blockExtended);
|
||||||
|
this.updateTimerProgress(timer, `saved ${this.currentBlockHeight} to database`);
|
||||||
|
|
||||||
|
if (!fastForwarded) {
|
||||||
const lastestPriceId = await PricesRepository.$getLatestPriceId();
|
const lastestPriceId = await PricesRepository.$getLatestPriceId();
|
||||||
this.updateTimerProgress(timer, `got latest price id ${this.currentBlockHeight}`);
|
this.updateTimerProgress(timer, `got latest price id ${this.currentBlockHeight}`);
|
||||||
if (priceUpdater.historyInserted === true && lastestPriceId !== null) {
|
if (priceUpdater.historyInserted === true && lastestPriceId !== null) {
|
||||||
|
@ -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>{{ block.extras.feeRange[1] | number:'1.0-0' }} - {{ block.extras.feeRange[block.extras.feeRange.length - 1] | 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;
|
||||||
@ -668,4 +672,23 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getMinBlockFee(block: BlockExtended): number {
|
||||||
|
if (block?.extras?.feeRange) {
|
||||||
|
// heuristic to check if feeRange is adjusted for effective rates
|
||||||
|
if (block.extras.medianFee === block.extras.feeRange[3]) {
|
||||||
|
return block.extras.feeRange[1];
|
||||||
|
} else {
|
||||||
|
return block.extras.feeRange[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
getMaxBlockFee(block: BlockExtended): number {
|
||||||
|
if (block?.extras?.feeRange) {
|
||||||
|
return block.extras.feeRange[block.extras.feeRange.length - 1];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
@ -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">
|
||||||
{{ block?.extras?.feeRange?.[0] | number:feeRounding }} - {{
|
{{ block.extras.minFee | number:feeRounding }} - {{ block.extras.maxFee | number:feeRounding }} <ng-container
|
||||||
block?.extras?.feeRange[block?.extras?.feeRange?.length - 1] | 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>
|
||||||
|
@ -114,6 +114,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);
|
||||||
|
|
||||||
@ -240,6 +243,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,
|
||||||
@ -278,6 +285,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);
|
||||||
}
|
}
|
||||||
@ -366,4 +375,23 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
}
|
}
|
||||||
return emptyBlocks;
|
return emptyBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getMinBlockFee(block: BlockExtended): number {
|
||||||
|
if (block?.extras?.feeRange) {
|
||||||
|
// heuristic to check if feeRange is adjusted for effective rates
|
||||||
|
if (block.extras.medianFee === block.extras.feeRange[3]) {
|
||||||
|
return block.extras.feeRange[1];
|
||||||
|
} else {
|
||||||
|
return block.extras.feeRange[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
getMaxBlockFee(block: BlockExtended): number {
|
||||||
|
if (block?.extras?.feeRange) {
|
||||||
|
return block.extras.feeRange[block.extras.feeRange.length - 1];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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