mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-04-02 20:11:28 +00:00
Add helper functions
This commit is contained in:
@ -1,7 +1,11 @@
|
||||
from typing import NamedTuple
|
||||
|
||||
FLOODSUB_PROTOCOL_ID = "/floodsub/1.0.0"
|
||||
GOSSIPSUB_PROTOCOL_ID = "/gossipsub/1.0.0"
|
||||
from libp2p.pubsub import floodsub
|
||||
from libp2p.pubsub import gossipsub
|
||||
|
||||
|
||||
FLOODSUB_PROTOCOL_ID = floodsub.PROTOCOL_ID
|
||||
GOSSIPSUB_PROTOCOL_ID = gossipsub.PROTOCOL_ID
|
||||
|
||||
|
||||
class GossipsubParams(NamedTuple):
|
||||
|
||||
@ -70,8 +70,7 @@ async def test_peers_subscribe(pubsubs_fsub):
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_hello_packet(pubsubs_fsub):
|
||||
def _get_hello_packet_topic_ids():
|
||||
packet = rpc_pb2.RPC()
|
||||
packet.ParseFromString(pubsubs_fsub[0].get_hello_packet())
|
||||
packet = pubsubs_fsub[0].get_hello_packet()
|
||||
return tuple(sub.topicid for sub in packet.subscriptions)
|
||||
|
||||
# Test: No subscription, so there should not be any topic ids in the hello packet.
|
||||
|
||||
Reference in New Issue
Block a user