mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
signed-peer-record transfer integrated with pubsub rpc message trasfer
This commit is contained in:
@ -15,6 +15,7 @@ from libp2p.custom_types import (
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
)
|
||||
from libp2p.peer.peerstore import create_signed_peer_record
|
||||
|
||||
from .exceptions import (
|
||||
PubsubRouterError,
|
||||
@ -103,6 +104,15 @@ class FloodSub(IPubsubRouter):
|
||||
)
|
||||
rpc_msg = rpc_pb2.RPC(publish=[pubsub_msg])
|
||||
|
||||
# Add the senderRecord of the peer in the RPC msg
|
||||
if isinstance(self.pubsub, Pubsub):
|
||||
envelope = create_signed_peer_record(
|
||||
self.pubsub.host.get_id(),
|
||||
self.pubsub.host.get_addrs(),
|
||||
self.pubsub.host.get_private_key(),
|
||||
)
|
||||
rpc_msg.senderRecord = envelope.marshal_envelope()
|
||||
|
||||
logger.debug("publishing message %s", pubsub_msg)
|
||||
|
||||
if self.pubsub is None:
|
||||
|
||||
Reference in New Issue
Block a user