Skip to content

Commit a8d650f

Browse files
committed
fix(net): guard relay nodes in peer connection
1 parent 441c716 commit a8d650f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

framework/src/main/java/org/tron/core/net/peer/PeerConnection.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@
5757
@Scope("prototype")
5858
public class PeerConnection {
5959

60-
private static List<InetSocketAddress> relayNodes = Args.getInstance().getFastForwardNodes();
61-
6260
@Getter
6361
private PeerStatistics peerStatistics = new PeerStatistics();
6462

@@ -166,7 +164,9 @@ public class PeerConnection {
166164

167165
public void setChannel(Channel channel) {
168166
this.channel = channel;
169-
if (relayNodes.stream().anyMatch(n -> n.getAddress().equals(channel.getInetAddress()))) {
167+
List<InetSocketAddress> relayNodes = Args.getInstance().getFastForwardNodes();
168+
if (relayNodes != null
169+
&& relayNodes.stream().anyMatch(n -> n.getAddress().equals(channel.getInetAddress()))) {
170170
this.isRelayPeer = true;
171171
}
172172
this.nodeStatistics = TronStatsManager.getNodeStatistics(channel.getInetAddress());

0 commit comments

Comments
 (0)