UNPKG

@lodestar/beacon-node

Version:

A Typescript implementation of the beacon chain

53 lines 1.63 kB
import { GoodByeReasonCode } from "../../../constants/network.js"; import { IPeerScore, PeerScoreStat } from "./interface.js"; /** * Manage score of a peer. */ export declare class RealScore implements IPeerScore { private lodestarScore; private gossipScore; private ignoreNegativeGossipScore; /** The final score, computed from the above */ private score; private lastUpdate; constructor(); isCoolingDown(): boolean; getScore(): number; getGossipScore(): number; add(scoreDelta: number): number; applyReconnectionCoolDown(reason: GoodByeReasonCode): number; /** * Applies time-based logic such as decay rates to the score. * This function should be called periodically. * * Return the new score. */ update(): number; updateGossipsubScore(newScore: number, ignore: boolean): void; getStat(): PeerScoreStat; /** * Updating lodestarScore should always go through this method, * so that we update this.score accordingly. */ private setLodestarScore; /** * Compute the final score, ban peer if needed */ private updateState; /** * Compute the final score */ private recomputeScore; } /** An implementation of IPeerScore for testing */ export declare class MaxScore implements IPeerScore { getScore(): number; getGossipScore(): number; isCoolingDown(): boolean; add(): number; update(): number; applyReconnectionCoolDown(_reason: GoodByeReasonCode): number; updateGossipsubScore(): void; getStat(): PeerScoreStat; } //# sourceMappingURL=score.d.ts.map