Confirm that a send has completed. Does not actually check confirmations,
    but instead assumes that if this is called, the transaction has been
    completed. This is because we assume our own sends are safe.

    :param session:
    :param str ref_id: The updated ref_id for the transaction in question
    :param str address: The address that was sent to
    :param Amount amount: The amount that was sent

def confirm_send(address, amount, ref_id=None, session=ses):
    """
    Confirm that a send has completed. Does not actually check confirmations,
    but instead assumes that if this is called, the transaction has been
    completed. This is because we assume our own sends are safe.

    :param session:
    :param str ref_id: The updated ref_id for the transaction in question
    :param str address: The address that was sent to
    :param Amount amount: The amount that was sent
    """
    debitq = session.query(wm.Debit)
    debitq = debitq.filter(wm.Debit.address == address)
    debitq = debitq.filter(wm.Debit.amount == amount)
    debit = debitq.filter(wm.Debit.transaction_state == 'unconfirmed').first()
    if not debit:
        raise ValueError("Debit already confirmed or address unknown.")
    debit.transaction_state = 'complete'
    if ref_id is not None:
        debit.ref_id = ref_id
    session.add(debit)
    session.commit()
    return debit