Beispiel #1
0
def is_head_block_num():
    '''
    Check if testnet is running.
    '''
    get_info = cleos.GetInfo(is_verbose=False)
    try: # if running, json is produced
        head_block_num = int(get_info.json["head_block_num"])
    except:
        head_block_num = -1
    return head_block_num > 0
Beispiel #2
0
def status():
    '''
    Display EOS node status.
    '''
    get_info = cleos.GetInfo(is_verbose=0)

    logger.INFO('''
    ######### Node ``{}``, head block number ``{}``.
    '''.format(
        setup.nodeos_address(),
        get_info.json["head_block_num"]))
Beispiel #3
0
def node_probe(verbosity=None):
    count = 15
    num = 5
    block_num = None

    while True:
        time.sleep(1)

        try:
            if setup.node_api == "cleos":
                import eosfactory.core.cleos as cleos
            elif setup.node_api == "eosjs":
                import eosfactory.core.eosjs as cleos

            get_info = cleos.GetInfo(is_verbose=0)
            head_block_num = int(get_info.json["head_block_num"])
        except:
            head_block_num = 0
        finally:
            print(".", end="", flush=True)

        if block_num is None:
            block_num = head_block_num

        if head_block_num - block_num >= num:
            print()
            logger.INFO(
                '''
            Local node is running. Block number is {}
            '''.format(head_block_num), verbosity)
            break

        count = count - 1
        if count <= 0:
            raise errors.Error('''
            The local node does not respond.
            ''')
Beispiel #4
0
def info():
    '''
    Display EOS node info.
    '''
    get_info = cleos.GetInfo(is_verbose=False)
    logger.INFO(str(get_info))