remove unneeded function and use is_trusted_peer

This commit is contained in:
Earle Lowe 2023-02-20 15:29:08 -08:00
parent fe5d9c12e0
commit 7cb0344be8
No known key found for this signature in database
2 changed files with 2 additions and 13 deletions

View File

@ -53,7 +53,7 @@ async def print_connections(rpc_client: RpcClient, trusted_peers: Dict[str, Any]
import time
from chia.server.outbound_message import NodeType
from chia.util.network import is_trusted_inner
from chia.util.network import is_trusted_peer
connections = await rpc_client.get_connections()
print("Connections:")
@ -68,7 +68,7 @@ async def print_connections(rpc_client: RpcClient, trusted_peers: Dict[str, Any]
# Strip IPv6 brackets
host = host.strip("[]")
trusted: bool = is_trusted_inner(host, con["node_id"], trusted_peers, False)
trusted: bool = is_trusted_peer(host, con["node_id"], trusted_peers, False)
# Nodetype length is 9 because INTRODUCER will be deprecated
if NodeType(con["type"]) is NodeType.FULL_NODE:
peak_height = con.get("peak_height", None)

View File

@ -175,17 +175,6 @@ def get_host_addr(host: str, *, prefer_ipv6: bool = False) -> IPAddress:
raise ValueError(f"failed to resolve {host} into an IP address")
def is_trusted_inner(peer_host: str, peer_node_id: bytes32, trusted_peers: Dict, testing: bool) -> bool:
if trusted_peers is None:
return False
if not testing and peer_host == "127.0.0.1":
return True
if peer_node_id.hex() not in trusted_peers:
return False
return True
def select_port(prefer_ipv6: bool, addresses: List[Any]) -> uint16:
selected_port: uint16
for address_string, port, *_ in addresses: