Beispiel #1
0
def depositin(address, value):
    channels = get_channelnames_via_address(address)
    success_channel = []
    for channel in channels:
        print(channel.channel_name)
        sender, receiver = split_channel_name(channel.channel_name)
        ch = Channel(sender, receiver)
        # if address == sender and value == ch.sender_deposit_cache:
        if address == sender:
            ch.set_channel_open()
            success_channel.append(channel.channel_name)
        # elif address == receiver and value == ch.receiver_deposit_cache:
        elif address == receiver:
            ch.set_channel_open()
            success_channel.append(channel.channel_name)
        else:
            continue
Beispiel #2
0
def send_raw_transaction(sender_address, channel_name, hex):
    """

    :param sender_address:
    :param channel_name:
    :param hex:
    :return:
    """

    blockchain.send_raw_transection(hex)
    sender, receiver = split_channel_name(channel_name)
    ch = Channel(sender, receiver)
    sender_deposit = ch.sender_deposit
    receiver_deposit = ch.receiver_deposit
    sender_cache = ch.sender_deposit_cache
    receiver_cache = ch.receiver_deposit_cache
    ch.update_channel_deposit(sender_deposit=sender_deposit + sender_cache,
                              receiver_deposit=receiver_deposit +
                              receiver_cache)

    return ch.set_channel_open()