コード例 #1
0
ファイル: channel.py プロジェクト: soros1321/trinity
 def channel_name(self):
     channel_name = "".join(map(lambda x, y: x+y, self.sender, self.receiver))
     peer_channel_name= "".join(map(lambda x, y: x+y, self.receiver, self.sender))
     if ChannelState(peer_channel_name).find_channel():
         return peer_channel_name
     else:
         return channel_name
コード例 #2
0
ファイル: manager.py プロジェクト: trinity-project/trinity
def settle_raw_tx(address, channel_name, txdata, signature):
    sig_in_channel = ChannelState(channel_name)
    if sig_in_channel.senderinDB == address:
        sig_in_channel.update_sender_signature(signature)
    elif sig_in_channel.recieverinDB == address:
        sig_in_channel.update_receiver_signature(signature)
        Message.set_message_done(address, channel_name)
    else:
        return "address not match the channel"
    Message.set_message_done(address, channel_name)

    if sig_in_channel.sender_signature and sig_in_channel.receiver_signature:
        print("sig_in_channel")
        raw_data = blockchain.construct_deposit_raw_tx(
            txdata, sig_in_channel.sender_signature,
            sig_in_channel.receiver_signature, sig_in_channel.contract_hash)
        blockchain.send_raw_transaction(raw_data)
        return "Success"
    else:
        return None
コード例 #3
0
 def channel_name(self):
     channel_name = ChannelState.query_channel_name(self.sender, self.receiver)
     return channel_name if channel_name else generate_channel_name(self.sender, self.receiver)
コード例 #4
0
 def __init__(self, sender, receiver):
     self.sender = sender
     self.receiver = receiver
     ChannelState.__init__(self, self.channel_name)
コード例 #5
0
def split_channel_name(channel_name):
    channel = ChannelState(channel_name)
    sender_addr = channel.senderinDB
    receiver_addr = channel.recieverinDB
    return sender_addr, receiver_addr