From 1af38456f3baa5a01a5b2413588f7c0228c21dae Mon Sep 17 00:00:00 2001 From: Mononaut Date: Mon, 3 Oct 2022 16:57:15 +0000 Subject: [PATCH] Fix tx marker boundary condition --- .../mempool-blocks/mempool-blocks.component.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts b/frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts index 17236e2ca..e1a443680 100644 --- a/frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts +++ b/frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts @@ -287,11 +287,12 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy { this.arrowVisible = true; - for (const block of this.mempoolBlocks) { - for (let i = 0; i < block.feeRange.length - 1; i++) { + let found = false; + for (let txInBlockIndex = 0; txInBlockIndex < this.mempoolBlocks.length && !found; txInBlockIndex++) { + const block = this.mempoolBlocks[txInBlockIndex]; + for (let i = 0; i < block.feeRange.length - 1 && !found; i++) { if (this.txFeePerVSize < block.feeRange[i + 1] && this.txFeePerVSize >= block.feeRange[i]) { - const txInBlockIndex = this.mempoolBlocks.indexOf(block); - const feeRangeIndex = block.feeRange.findIndex((val, index) => this.txFeePerVSize < block.feeRange[index + 1]); + const feeRangeIndex = i; const feeRangeChunkSize = 1 / (block.feeRange.length - 1); const txFee = this.txFeePerVSize - block.feeRange[i]; @@ -306,9 +307,13 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy { + ((1 - feePosition) * blockedFilledPercentage * this.blockWidth); this.rightPosition = arrowRightPosition; - break; + found = true; } } + if (this.txFeePerVSize >= block.feeRange[block.feeRange.length - 1]) { + this.rightPosition = txInBlockIndex * (this.blockWidth + this.blockPadding); + found = true; + } } }