libp2p / py-libp2p

The Python implementation of the libp2p networking stack 🐍 [under development]
https://libp2p.io
Other
478 stars 106 forks source link

Race conditions dealing with new peers and possibly pubsub {un,}subscriptions #418

Open ralexstokes opened 4 years ago

ralexstokes commented 4 years ago

When writing tests to connect two hosts and have them share gossip, I find I have to insert arbitrary trio.sleep(n) to ensure state inside the libp2p machinery has had time to settle.

Ideally when we call some function async do_a_thing, await do_a_thing blocks until the action has completed and all internal state reflects this effect.

Ping me for an example in https://github.com/ethereum/trinity