mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-09 22:50:54 +00:00
added tests for signed-peee-record transfer in kad-dht
This commit is contained in:
@ -271,7 +271,6 @@ class KadDHT(Service):
|
||||
# Handle FIND_NODE message
|
||||
if message.type == Message.MessageType.FIND_NODE:
|
||||
# Get target key directly from protobuf
|
||||
print("FIND NODE RECEIVED")
|
||||
target_key = message.key
|
||||
|
||||
# Find closest peers to the target key
|
||||
@ -353,6 +352,7 @@ class KadDHT(Service):
|
||||
|
||||
# Handle ADD_PROVIDER message
|
||||
elif message.type == Message.MessageType.ADD_PROVIDER:
|
||||
print("ADD_PROVIDER REQ RECEIVED")
|
||||
# Process ADD_PROVIDER
|
||||
key = message.key
|
||||
logger.debug(f"Received ADD_PROVIDER for key {key.hex()}")
|
||||
@ -449,6 +449,7 @@ class KadDHT(Service):
|
||||
|
||||
# Handle GET_PROVIDERS message
|
||||
elif message.type == Message.MessageType.GET_PROVIDERS:
|
||||
print("GET_PROVIDERS REQ RECIEVED")
|
||||
# Process GET_PROVIDERS
|
||||
key = message.key
|
||||
logger.debug(f"Received GET_PROVIDERS request for key {key.hex()}")
|
||||
@ -559,6 +560,7 @@ class KadDHT(Service):
|
||||
|
||||
# Handle GET_VALUE message
|
||||
elif message.type == Message.MessageType.GET_VALUE:
|
||||
print("GET VALUE REQ RECEIVED")
|
||||
# Process GET_VALUE
|
||||
key = message.key
|
||||
logger.debug(f"Received GET_VALUE request for key {key.hex()}")
|
||||
|
||||
@ -257,8 +257,6 @@ class PeerRouting(IPeerRouting):
|
||||
find_node_msg.type = Message.MessageType.FIND_NODE
|
||||
find_node_msg.key = target_key # Set target key directly as bytes
|
||||
|
||||
print("MESSAGE GOING TO BE CREATED")
|
||||
|
||||
# Create sender_signed_peer_record
|
||||
envelope = create_signed_peer_record(
|
||||
self.host.get_id(), self.host.get_addrs(), self.host.get_private_key()
|
||||
|
||||
@ -46,8 +46,6 @@ def create_signed_peer_record(
|
||||
"""Creates a signed_peer_record wrapped in an Envelope"""
|
||||
record = PeerRecord(peer_id, addrs)
|
||||
envelope = seal_record(record, pvt_key)
|
||||
|
||||
print(envelope)
|
||||
return envelope
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user