added tests

This commit is contained in:
lla-dane
2025-07-02 19:43:31 +05:30
parent a89ba8ef81
commit 383d7cb722
2 changed files with 6 additions and 1 deletions

View File

@ -176,7 +176,9 @@ async def push_identify_to_peers(
host: IHost,
peer_ids: set[ID] | None = None,
observed_multiaddr: Multiaddr | None = None,
) -> None:
counter: dict[str, int] | None = None,
lock: trio.Lock | None = None,
) -> int: # <-- return the max concurrency
"""
Push an identify message to multiple peers in parallel.
@ -191,3 +193,5 @@ async def push_identify_to_peers(
async with trio.open_nursery() as nursery:
for peer_id in peer_ids:
nursery.start_soon(limited_push, peer_id)
return counter["max"] if counter else 0

View File

@ -10,6 +10,7 @@ import trio
from libp2p import (
new_host,
)
from libp2p.abc import IHost
from libp2p.crypto.secp256k1 import (
create_new_key_pair,
)