From 89d2e76f740e29b613ea0ca9a0c1c0afe6ea6ac3 Mon Sep 17 00:00:00 2001 From: Djordje Kovacevic Date: Tue, 5 Sep 2023 10:29:22 +0200 Subject: [PATCH] Minor chages for bid suggestion --- src/service/sharding-table-service.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/service/sharding-table-service.js b/src/service/sharding-table-service.js index a1200c0deb..fcc63c00eb 100644 --- a/src/service/sharding-table-service.js +++ b/src/service/sharding-table-service.js @@ -169,8 +169,8 @@ class ShardingTableService { const filteredPeerRecords = peerRecords.filter((peer) => peer.peerId !== myPeerId); const sorted = filteredPeerRecords.sort((a, b) => a.ask - b.ask); let ask; - if (sorted.length > r1) { - ask = sorted[r1 - 1].ask; + if (sorted.length > r1 + 1) { + ask = sorted[r1].ask; } else { ask = sorted[sorted.length - 1].ask; }