File tree Expand file tree Collapse file tree
framework/src/main/java/org/tron/core/net/peer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77import java .net .InetSocketAddress ;
88import java .util .Deque ;
99import java .util .HashSet ;
10+ import java .util .List ;
1011import java .util .Locale ;
1112import java .util .Map ;
1213import java .util .Set ;
2829import org .tron .core .Constant ;
2930import org .tron .core .capsule .BlockCapsule .BlockId ;
3031import org .tron .core .config .Parameter .NetConstants ;
32+ import org .tron .core .config .args .Args ;
3133import org .tron .core .metrics .MetricsKey ;
3234import org .tron .core .metrics .MetricsUtil ;
3335import org .tron .core .net .TronNetDelegate ;
5052@ Scope ("prototype" )
5153public class PeerConnection {
5254
55+ private static List <InetSocketAddress > relayNodes = Args .getInstance ().getFastForwardNodes ();
56+
5357 @ Getter
5458 private PeerStatistics peerStatistics = new PeerStatistics ();
5559
@@ -61,7 +65,7 @@ public class PeerConnection {
6165
6266 @ Getter
6367 @ Setter
64- private boolean isRelayPeer ;
68+ private volatile boolean isRelayPeer ;
6569
6670 @ Getter
6771 @ Setter
@@ -143,6 +147,9 @@ public class PeerConnection {
143147
144148 public void setChannel (Channel channel ) {
145149 this .channel = channel ;
150+ if (relayNodes .contains (channel .getInetSocketAddress ())) {
151+ this .isRelayPeer = true ;
152+ }
146153 this .nodeStatistics = TronStatsManager .getNodeStatistics (channel .getInetAddress ());
147154 }
148155
You can’t perform that action at this time.
0 commit comments