mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-09 22:50:54 +00:00
Now using env_to_send_in_RPC for issuing records in Identify rpc messages
This commit is contained in:
@ -15,7 +15,7 @@ from libp2p.custom_types import (
|
|||||||
from libp2p.network.stream.exceptions import (
|
from libp2p.network.stream.exceptions import (
|
||||||
StreamClosed,
|
StreamClosed,
|
||||||
)
|
)
|
||||||
from libp2p.peer.peerstore import create_signed_peer_record
|
from libp2p.peer.peerstore import env_to_send_in_RPC
|
||||||
from libp2p.utils import (
|
from libp2p.utils import (
|
||||||
decode_varint_with_size,
|
decode_varint_with_size,
|
||||||
get_agent_version,
|
get_agent_version,
|
||||||
@ -65,11 +65,7 @@ def _mk_identify_protobuf(
|
|||||||
protocols = tuple(str(p) for p in host.get_mux().get_protocols() if p is not None)
|
protocols = tuple(str(p) for p in host.get_mux().get_protocols() if p is not None)
|
||||||
|
|
||||||
# Create a signed peer-record for the remote peer
|
# Create a signed peer-record for the remote peer
|
||||||
envelope = create_signed_peer_record(
|
envelope_bytes, _ = env_to_send_in_RPC(host)
|
||||||
host.get_id(),
|
|
||||||
host.get_addrs(),
|
|
||||||
host.get_private_key(),
|
|
||||||
)
|
|
||||||
|
|
||||||
observed_addr = observed_multiaddr.to_bytes() if observed_multiaddr else b""
|
observed_addr = observed_multiaddr.to_bytes() if observed_multiaddr else b""
|
||||||
return Identify(
|
return Identify(
|
||||||
@ -79,7 +75,7 @@ def _mk_identify_protobuf(
|
|||||||
listen_addrs=map(_multiaddr_to_bytes, laddrs),
|
listen_addrs=map(_multiaddr_to_bytes, laddrs),
|
||||||
observed_addr=observed_addr,
|
observed_addr=observed_addr,
|
||||||
protocols=protocols,
|
protocols=protocols,
|
||||||
signedPeerRecord=envelope.marshal_envelope(),
|
signedPeerRecord=envelope_bytes,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user