Add typing and notes in pubsub

This commit is contained in:
mhchia
2019-07-24 14:54:30 +08:00
parent 1e78c21eca
commit d6c19e71a6
2 changed files with 69 additions and 15 deletions

View File

@ -1,3 +1,7 @@
from libp2p.peer.id import (
ID,
)
from .pb import rpc_pb2
from .pubsub_router_interface import IPubsubRouter
@ -42,7 +46,7 @@ class FloodSub(IPubsubRouter):
:param rpc: rpc message
"""
async def publish(self, sender_peer_id, rpc_message):
async def publish(self, from_peer: ID, pubsub_message: rpc_pb2.Message) -> None:
"""
Invoked to forward a new message that has been validated.
This is where the "flooding" part of floodsub happens