mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-11 23:51:07 +00:00
add reissuing mechanism of records if addrs dont change
This commit is contained in:
@ -15,11 +15,10 @@ from libp2p.abc import (
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.kad_dht.utils import maybe_consume_signed_record
|
||||
from libp2p.kad_dht.utils import env_to_send_in_RPC, maybe_consume_signed_record
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
)
|
||||
from libp2p.peer.peerstore import create_signed_peer_record
|
||||
|
||||
from .common import (
|
||||
DEFAULT_TTL,
|
||||
@ -113,12 +112,8 @@ class ValueStore:
|
||||
message.type = Message.MessageType.PUT_VALUE
|
||||
|
||||
# Create sender's signed-peer-record
|
||||
envelope = create_signed_peer_record(
|
||||
self.host.get_id(),
|
||||
self.host.get_addrs(),
|
||||
self.host.get_private_key(),
|
||||
)
|
||||
message.senderRecord = envelope.marshal_envelope()
|
||||
envelope_bytes, bool = env_to_send_in_RPC(self.host)
|
||||
message.senderRecord = envelope_bytes
|
||||
|
||||
# Set message fields
|
||||
message.key = key
|
||||
@ -245,12 +240,8 @@ class ValueStore:
|
||||
message.key = key
|
||||
|
||||
# Create sender's signed-peer-record
|
||||
envelope = create_signed_peer_record(
|
||||
self.host.get_id(),
|
||||
self.host.get_addrs(),
|
||||
self.host.get_private_key(),
|
||||
)
|
||||
message.senderRecord = envelope.marshal_envelope()
|
||||
envelope_bytes, bool = env_to_send_in_RPC(self.host)
|
||||
message.senderRecord = envelope_bytes
|
||||
|
||||
# Serialize and send the protobuf message
|
||||
proto_bytes = message.SerializeToString()
|
||||
|
||||
Reference in New Issue
Block a user