def propagate_exchange(cursor, participant, route, error, amount):
    route.update_error(error or '')
    new_balance = cursor.one("""
        UPDATE participants
           SET balance=(balance + %s)
         WHERE id=%s
     RETURNING balance
    """, (amount, participant.id))

    if amount < 0 and new_balance < 0:
        raise NegativeBalance

    if hasattr(participant, 'set_attributes'):
        participant.set_attributes(balance=new_balance)
Initialize the instance with the given modules.
dataset/ETHPy150Open gratipay/gratipay.com/gratipay/billing/exchanges.py/propagate_exchange--crossover with--dataset/ETHPy150Open VisTrails/VisTrails/contrib/titan/class_tree.py/ClassTree.__init__