added tests for signed-peee-record transfer in kad-dht

This commit is contained in:
lla-dane
2025-08-10 14:59:55 +05:30
parent 53db128f69
commit d1792588f9
4 changed files with 137 additions and 6 deletions

View File

@ -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()}")

View File

@ -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()

View File

@ -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