示例#1
0
def wait_for_sync_rpc_api(
        blockchain_service: BlockChainService,
        sleep: float,
) -> None:
    if blockchain_service.is_synced():
        return

    print('Waiting for the ethereum node to synchronize [Use ^C to exit].')

    for i in count():
        if i % 3 == 0:
            print(constants.ANSI_ESCAPE_CLEARLINE + constants.ANSI_ESCAPE_CURSOR_STARTLINE, end='')

        print('.', end='')
        sys.stdout.flush()

        gevent.sleep(sleep)

        if blockchain_service.is_synced():
            return
示例#2
0
def wait_for_sync_rpc_api(blockchain_service: BlockChainService,
                          sleep: float) -> None:
    if blockchain_service.is_synced():
        return

    print("Waiting for the ethereum node to synchronize [Use ^C to exit].")

    for i in count():
        if i % 3 == 0:
            print("\r", end="")

        print(".", end="")
        sys.stdout.flush()

        gevent.sleep(sleep)

        if blockchain_service.is_synced():
            return

    # add a newline so that the next print will start have it's own line
    print("")