Skip to content

Commit 8f28a78

Browse files
committed
getShard: filter peers with ±1 block tolerance
1 parent 0fe7f99 commit 8f28a78

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/libs/consensus/v2/routines/getShard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default async function getShard(seed: string): Promise<Peer[]> {
1515
// ! we need to get the peers from the last 3 blocks too
1616
const allPeers = await PeerManager.getInstance().getOnlinePeers()
1717
const peers = allPeers.filter(
18-
peer => peer.status.online && peer.sync.status,
18+
peer => peer.status.online && peer.sync.status && Math.abs(peer.sync.block - getSharedState.lastBlockNumber) <= 1,
1919
)
2020

2121
// Select up to 10 peers from the list using the seed as a source of randomness

0 commit comments

Comments
 (0)