diff --git a/libp2p/kad_dht/common.py b/libp2p/kad_dht/common.py index d7fb6c76..392bffd0 100644 --- a/libp2p/kad_dht/common.py +++ b/libp2p/kad_dht/common.py @@ -1,5 +1,5 @@ """ -Common Objects for Kademlia DHT implementation. +Shared constants and protocol parameters for the Kademlia DHT. """ from libp2p.custom_types import ( diff --git a/libp2p/kad_dht/kad_dht.py b/libp2p/kad_dht/kad_dht.py index b47d59e7..dcf323ba 100644 --- a/libp2p/kad_dht/kad_dht.py +++ b/libp2p/kad_dht/kad_dht.py @@ -5,7 +5,9 @@ This module provides a complete Distributed Hash Table (DHT) implementation based on the Kademlia algorithm and protocol. """ -from enum import Enum +from enum import ( + Enum, +) import logging import time diff --git a/libp2p/kad_dht/routing_table.py b/libp2p/kad_dht/routing_table.py index af4c7439..9ca59031 100644 --- a/libp2p/kad_dht/routing_table.py +++ b/libp2p/kad_dht/routing_table.py @@ -2,13 +2,17 @@ Kademlia DHT routing table implementation. """ -from collections import OrderedDict +from collections import ( + OrderedDict, +) import logging import time import trio -from libp2p.abc import IHost +from libp2p.abc import ( + IHost, +) from libp2p.kad_dht.utils import ( xor_distance, ) @@ -238,12 +242,9 @@ class KBucket: if not peer_info: raise ValueError(f"Peer {peer_id} not in bucket") - # Default protocol ID for Kademlia DHT - protocol_id = PROTOCOL_ID - try: # Open a stream to the peer with the DHT protocol - stream = await self.host.new_stream(peer_id, [protocol_id]) + stream = await self.host.new_stream(peer_id, [PROTOCOL_ID]) try: # Create ping protobuf message