mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
chore: eliminate self.protocol_id attribute \w in PeerRouting
This commit is contained in:
@ -60,7 +60,6 @@ class PeerRouting(IPeerRouting):
|
||||
"""
|
||||
self.host = host
|
||||
self.routing_table = routing_table
|
||||
self.protocol_id = PROTOCOL_ID
|
||||
|
||||
async def find_peer(self, peer_id: ID) -> PeerInfo | None:
|
||||
"""
|
||||
@ -245,7 +244,7 @@ class PeerRouting(IPeerRouting):
|
||||
# Open a stream to the peer using the Kademlia protocol
|
||||
logger.debug(f"Opening stream to {peer} for closest peers query")
|
||||
try:
|
||||
stream = await self.host.new_stream(peer, [self.protocol_id])
|
||||
stream = await self.host.new_stream(peer, [PROTOCOL_ID])
|
||||
logger.debug(f"Stream opened to {peer}")
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to open stream to {peer}: {e}")
|
||||
|
||||
@ -89,7 +89,6 @@ class TestPeerRouting:
|
||||
|
||||
assert peer_routing.host == mock_host
|
||||
assert peer_routing.routing_table == mock_routing_table
|
||||
assert peer_routing.protocol_id == PROTOCOL_ID
|
||||
|
||||
@pytest.mark.trio
|
||||
async def test_find_peer_local_host(self, peer_routing, mock_host):
|
||||
|
||||
Reference in New Issue
Block a user