Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ private int getSessionFairReputation() {
}
}
}
int score = discoverReput + 10 * reput - disconnectTimes * 20;
int score =
discoverReput + 10 * reput - (int) Math.pow(2, disconnectTimes) * (disconnectTimes > 0 ? 10
: 0);
return score > 0 ? score : 0;
}

Expand Down Expand Up @@ -193,13 +195,15 @@ public boolean isPenalized() {
public void nodeDisconnectedRemote(ReasonCode reason) {
lastDisconnectedTime = System.currentTimeMillis();
tronLastRemoteDisconnectReason = reason;
disconnectTimes++;
persistedReputation = persistedReputation / 2;
}

public void nodeDisconnectedLocal(ReasonCode reason) {
lastDisconnectedTime = System.currentTimeMillis();
tronLastLocalDisconnectReason = reason;
}

public void notifyDisconnect() {
lastDisconnectedTime = System.currentTimeMillis();
disconnectTimes++;
persistedReputation = persistedReputation / 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public void notifyDisconnect(Channel channel) {
|| channel.getChannelHandlerContext().channel() == null) {
return;
}
channel.getNodeStatistics().notifyDisconnect();
InetSocketAddress socketAddress = (InetSocketAddress) channel.getChannelHandlerContext()
.channel().remoteAddress();
recentlyDisconnected.put(socketAddress.getAddress(), new Date());
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/org/tron/common/overlay/server/SyncPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,6 @@ public boolean test(NodeHandler handler) {
if (handler.getNodeStatistics().getReputation() < 100) {
return false;
}

if (handler.getNodeStatistics().isPenalized()) {
return false;
}

return true;
}
Expand Down