diff --git a/backend/src/api/websocket-handler.ts b/backend/src/api/websocket-handler.ts index 3b3ce881a..0f37db97e 100644 --- a/backend/src/api/websocket-handler.ts +++ b/backend/src/api/websocket-handler.ts @@ -70,7 +70,7 @@ class WebsocketHandler { client.send(JSON.stringify({ 'mempoolInfo': memPool.getMempoolInfo(), 'vBytesPerSecond': memPool.getVBytesPerSecond(), - 'blocks': _blocks.slice(config.INITIAL_BLOCK_AMOUNT), + 'blocks': _blocks.slice(Math.max(_blocks.length - config.INITIAL_BLOCK_AMOUNT, 0)), 'conversions': fiatConversion.getTickers()['BTCUSD'], 'mempool-blocks': mempoolBlocks.getMempoolBlocks(), 'git-commit': this.latestGitCommitHash diff --git a/frontend/src/app/components/transaction/transaction.component.ts b/frontend/src/app/components/transaction/transaction.component.ts index 29e138159..6aa582fb3 100644 --- a/frontend/src/app/components/transaction/transaction.component.ts +++ b/frontend/src/app/components/transaction/transaction.component.ts @@ -98,12 +98,19 @@ export class TransactionComponent implements OnInit, OnDestroy { .pipe(filter((block) => block.height === this.tx.status.block_height)) .subscribe((block) => { const feePervByte = this.tx.fee / (this.tx.weight / 4); + let medianFee = block.feeRange[Math.round(block.feeRange.length * 0.5)]; - if (feePervByte <= block.feeRange[Math.round(block.feeRange.length * 0.5)]) { + // Block not filled + if (block.weight < 4000000 * 0.95) { + medianFee = 1; + } + + this.overpaidTimes = Math.round(feePervByte / block.medianFee); + + if (feePervByte <= medianFee || this.overpaidTimes < 2) { this.feeRating = 1; } else { this.feeRating = 2; - this.overpaidTimes = Math.round(feePervByte / block.medianFee); if (this.overpaidTimes > 10) { this.feeRating = 3; }