use of co.rsk.scoring.PunishmentParameters in project rskj by rsksmart.
the class RskFactory method getPeerScoringManager.
@Bean
public PeerScoringManager getPeerScoringManager(SystemProperties config) {
int nnodes = config.scoringNumberOfNodes();
long nodePunishmentDuration = config.scoringNodesPunishmentDuration();
int nodePunishmentIncrement = config.scoringNodesPunishmentIncrement();
long nodePunhishmentMaximumDuration = config.scoringNodesPunishmentMaximumDuration();
long addressPunishmentDuration = config.scoringAddressesPunishmentDuration();
int addressPunishmentIncrement = config.scoringAddressesPunishmentIncrement();
long addressPunishmentMaximunDuration = config.scoringAddressesPunishmentMaximumDuration();
return new PeerScoringManager(nnodes, new PunishmentParameters(nodePunishmentDuration, nodePunishmentIncrement, nodePunhishmentMaximumDuration), new PunishmentParameters(addressPunishmentDuration, addressPunishmentIncrement, addressPunishmentMaximunDuration));
}
use of co.rsk.scoring.PunishmentParameters in project rskj by rsksmart.
the class RskContext method getPeerScoringManager.
public synchronized PeerScoringManager getPeerScoringManager() {
checkIfNotClosed();
if (peerScoringManager == null) {
RskSystemProperties rskSystemProperties = getRskSystemProperties();
List<String> bannedPeerIPs = rskSystemProperties.bannedPeerIPList();
List<String> bannedPeerIDs = rskSystemProperties.bannedPeerIDList();
peerScoringManager = new PeerScoringManager(() -> new PeerScoring(rskSystemProperties.scoringPunishmentEnabled()), rskSystemProperties.scoringNumberOfNodes(), new PunishmentParameters(rskSystemProperties.scoringNodesPunishmentDuration(), rskSystemProperties.scoringNodesPunishmentIncrement(), rskSystemProperties.scoringNodesPunishmentMaximumDuration()), new PunishmentParameters(rskSystemProperties.scoringAddressesPunishmentDuration(), rskSystemProperties.scoringAddressesPunishmentIncrement(), rskSystemProperties.scoringAddressesPunishmentMaximumDuration()), bannedPeerIPs, bannedPeerIDs);
}
return peerScoringManager;
}
Aggregations