async def set_vals(tmpdir_factory, overlay_class): dirs = [ tmpdir_factory.mktemp(str(overlay_class.__name__), numbered=True) for _ in range(NUM_NODES) ] nodes = create_and_connect_nodes(NUM_NODES, work_dirs=dirs, ov_class=overlay_class) # Make sure every node has a community to listen to community_key = default_eccrypto.generate_key(u"curve25519").pub() community_id = community_key.key_to_bin() yield SetupValues(nodes=nodes, community_id=community_id) await unload_nodes(nodes) for k in dirs: k.remove(ignore_errors=True)
async def set_vals(tmpdir_factory, community_cls, num_nodes): dirs = [ tmpdir_factory.mktemp(str(SimpleCommunity.__name__), numbered=True) for _ in range(num_nodes) ] nodes = create_and_connect_nodes(num_nodes, work_dirs=dirs, ov_class=community_cls) # Make sure every node has a community to listen to community_key = default_eccrypto.generate_key("curve25519").pub() community_id = community_key.key_to_bin() for node in nodes: node.overlay.subscribe_to_subcom(community_id) yield SetupValues(nodes=nodes, community_id=community_id) await unload_nodes(nodes) for k in dirs: k.remove(ignore_errors=True)
async def set_vals(tmpdir_factory, overlay_class, num_nodes): dirs = [ tmpdir_factory.mktemp(str(overlay_class.__name__), numbered=True) for _ in range(num_nodes) ] nodes = create_and_connect_nodes(num_nodes, work_dirs=dirs, ov_class=overlay_class) # Make sure every node has a community to listen to community_id = nodes[0].overlay.my_pub_key_bin context = nodes[0].overlay.state_db.context for node in nodes: node.overlay.subscribe_to_subcom(community_id) yield SetupValues(nodes=nodes, community_id=community_id, context=context) await unload_nodes(nodes) for k in dirs: k.remove(ignore_errors=True)