예제 #1
0
def test_witness_update():
    # TODO: Remove when witness_update is fixed.
    return
    wif = '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'
    c = Commit(steemd_instance=Steemd(nodes=[]), keys=[wif])

    signing_key = 'BMT1111111111111111111111111111111114T1Anm'
    props = {
        'account_creation_fee': '0.500 BMT',
        'maximum_block_size': 65536,
        'sbd_interest_rate': 0
    }

    rpc_error = None
    try:
        c.witness_update(signing_key=signing_key,
                         account='test',
                         props=props,
                         url='foo')
    except RPCError as e:
        rpc_error = str(e)
    else:
        raise Exception('expected RPCError')

    assert 'tx_missing_active_auth' in rpc_error
예제 #2
0
    disable_at = initial_misses + failover_after
    l("Initiated with {} misses, failover after {} more ({}).".format(
        initial_misses, failover_after, disable_at))
    while True:
        current_misses = get_misses()
        counter = (counter + 1) % 111
        if (counter == 0):
            l("Resetting initial misses to {}".format(current_misses))
            initial_misses = current_misses

        l("Currently {}, started at {}, stopping at {}".format(
            current_misses, initial_misses, disable_at))
        if current_misses >= disable_at:
            l("failover to {}".format(next_key))
            # Broadcast the next failover
            t.witness_update(signing_key=next_key,
                             url=witness_url,
                             props=witness_props,
                             account=steem_account)
            # Do we have more keys?
            if len(signing_keys) > 0:
                # Move onto the next key and await more failures
                next_key = signing_keys.pop(0)
                disable_at = current_misses + failover_after
            else:
                # No more keys to failover to, script needs terminating
                l("terminating failover, no more keys to failover to!")
                quit(0)
        time.sleep(60)