Skip to content

Commit

Permalink
fix: mock
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 committed Dec 20, 2024
1 parent d7d23d3 commit fa2d595
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions yarn-project/p2p/src/services/peer-scoring/peer_scoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ export class PeerScoring {
}

public getScoreState(peerId: string): PeerScoreState {
// TODO: permanently store banned peers?
const score = this.getScore(peerId);
if (score <= MIN_SCORE_BEFORE_BAN) {
if (score < MIN_SCORE_BEFORE_BAN) {
return PeerScoreState.Banned;
}
if (score <= MIN_SCORE_BEFORE_DISCONNECT) {
if (score < MIN_SCORE_BEFORE_DISCONNECT) {
return PeerScoreState.Disconnect;
}
return PeerScoreState.Healthy;
Expand Down
3 changes: 1 addition & 2 deletions yarn-project/p2p/src/services/peer_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@ describe('PeerManager', () => {
});

it('should properly clean up peers on stop', async () => {
const enr = await createMockENR();
await discoveredPeerCallback(enr);
mockLibP2PNode.getPeers.mockReturnValue([await createSecp256k1PeerId(), await createSecp256k1PeerId()]);

await peerManager.stop();

Expand Down
Empty file.

0 comments on commit fa2d595

Please sign in to comment.