예제 #1
0
async def receive_server():
    topic_msg_queues = {
        PUBSUB_TOPIC_BEACON_BLOCK: asyncio.Queue(),
        PUBSUB_TOPIC_BEACON_ATTESTATION: asyncio.Queue(),
    }
    chain = await get_fake_chain()
    server = ReceiveServerFactory(chain=chain,
                                  topic_msg_queues=topic_msg_queues)
    asyncio.ensure_future(server.run())
    await server.ready.wait()
    try:
        yield server
    finally:
        await server.cancel()
예제 #2
0
async def receive_server_with_mock_process_orphan_blocks_period(
        mock_process_orphan_blocks_period):
    topic_msg_queues = {
        PUBSUB_TOPIC_BEACON_BLOCK: asyncio.Queue(),
        PUBSUB_TOPIC_BEACON_ATTESTATION: asyncio.Queue(),
    }
    chain = await get_fake_chain()
    server = ReceiveServerFactory(chain=chain,
                                  topic_msg_queues=topic_msg_queues)
    asyncio.ensure_future(server.run())
    await server.events.started.wait()
    try:
        yield server
    finally:
        await server.cancel()
예제 #3
0
async def receive_server():
    topic_msg_queues = {
        PUBSUB_TOPIC_BEACON_BLOCK: asyncio.Queue(),
        PUBSUB_TOPIC_BEACON_ATTESTATION: asyncio.Queue(),
        PUBSUB_TOPIC_BEACON_AGGREGATE_AND_PROOF: asyncio.Queue(),
    }
    subnets = set(subnet_id for subnet_id in range(ATTESTATION_SUBNET_COUNT))
    for subnet_id in range(ATTESTATION_SUBNET_COUNT):
        topic = (PUBSUB_TOPIC_COMMITTEE_BEACON_ATTESTATION.substitute(
            subnet_id=subnet_id), )
        topic_msg_queues[topic] = asyncio.Queue()
    chain = await get_fake_chain()
    server = ReceiveServerFactory(chain=chain,
                                  topic_msg_queues=topic_msg_queues,
                                  subnets=subnets)
    asyncio.ensure_future(server.run())
    await server.ready.wait()
    try:
        yield server
    finally:
        await server.cancel()