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; }