Beispiel #1
0
def handle_routechange(state, state_change):
    """ Handle an ActionRouteChange state change. """
    # TODO: `update_route` only changes the RoutesState, instead of moving the
    # routes to the MediationPairState use identifier to reference the routes
    new_route = state_change.route
    used = False

    # a route in use might be closed because of another task, update the pair
    # state in-place
    for pair in state.transfers_pair:
        if pair.payee_route.node_address == new_route.node_address:
            pair.payee_route = new_route
            used = True

        if pair.payer_route.node_address == new_route.node_address:
            pair.payer_route = new_route
            used = True

    if not used:
        update_route(state, state_change)

    # a route might be closed by another task
    withdraw_events = events_for_withdraw(state.transfers_pair, )

    iteration = TransitionResult(
        state,
        withdraw_events,
    )
    return iteration
Beispiel #2
0
def handle_routechange(state, state_change):
    update_route(state, state_change)
    iteration = TransitionResult(state, list())
    return iteration
def handle_routechange(state, state_change):
    update_route(state, state_change)
    iteration = TransitionResult(state, list())
    return iteration