File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -339,7 +339,14 @@ impl<N: Network> Router<N> {
339339 if self . is_local_ip ( listener_addr) {
340340 bail ! ( "Dropping connection request from '{listener_addr}' (attempted to self-connect)" ) ;
341341 }
342- // Unknown peers are untrusted, so check if `trusted_peers_only` is true.
342+ // As a validator, only accept connections from trusted peers and bootstrap nodes.
343+ if self . node_type ( ) == NodeType :: Validator
344+ && !self . is_trusted ( listener_addr)
345+ && !crate :: bootstrap_peers :: < N > ( self . is_dev ( ) ) . contains ( & listener_addr)
346+ {
347+ bail ! ( "Dropping connection request from '{listener_addr}' (untrusted)" ) ;
348+ }
349+ // If the node is in trusted peers only mode, ensure the peer is explicitly trusted.
343350 if self . trusted_peers_only ( ) && !self . is_trusted ( listener_addr) {
344351 bail ! ( "Dropping connection request from '{listener_addr}' (untrusted)" ) ;
345352 }
You can’t perform that action at this time.
0 commit comments