Skip to content

Commit

Permalink
Use network.reportPeer
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Feb 20, 2022
1 parent a222e42 commit fe7601f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/lodestar/src/network/gossip/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function getGossipHandlers(modules: ValidatorFnsModules, options: GossipH
case BlockErrorCode.EXECUTION_ENGINE_ERROR:
break;
default:
network.peerRpcScores.applyAction(
network.reportPeer(
PeerId.createFromB58String(peerIdStr),
PeerAction.LowToleranceError,
"BadGossipBlock"
Expand Down
3 changes: 1 addition & 2 deletions packages/lodestar/src/network/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import PeerId from "peer-id";
import {INetworkEventBus} from "./events";
import {Eth2Gossipsub} from "./gossip";
import {MetadataController} from "./metadata";
import {IPeerRpcScoreStore, IPeerMetadataStore, PeerAction} from "./peers";
import {IPeerMetadataStore, PeerAction} from "./peers";
import {IReqResp} from "./reqresp";
import {IAttnetsService, ISubnetsService, CommitteeSubscription} from "./subnets";

Expand All @@ -25,7 +25,6 @@ export interface INetwork {
gossip: Eth2Gossipsub;
discv5?: Discv5;
metadata: MetadataController;
peerRpcScores: IPeerRpcScoreStore;
peerMetadata: IPeerMetadataStore;
/** Our network identity */
peerId: PeerId;
Expand Down
2 changes: 1 addition & 1 deletion packages/lodestar/src/network/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class Network implements INetwork {
gossip: Eth2Gossipsub;
metadata: MetadataController;
peerMetadata: IPeerMetadataStore;
peerRpcScores: IPeerRpcScoreStore;
private readonly peerRpcScores: IPeerRpcScoreStore;

private readonly peerManager: PeerManager;
private readonly libp2p: LibP2p;
Expand Down
2 changes: 1 addition & 1 deletion packages/lodestar/src/sync/unknownBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export class UnknownBlockSync {
for (const peerIdStr of block.peerIdStrs) {
// TODO: Refactor peerRpcScores to work with peerIdStr only
const peer = PeerId.createFromB58String(peerIdStr);
this.network.peerRpcScores.applyAction(peer, PeerAction.LowToleranceError, "BadBlockByRoot");
this.network.reportPeer(peer, PeerAction.LowToleranceError, "BadBlockByRoot");
}
}

Expand Down

0 comments on commit fe7601f

Please sign in to comment.