Ejemplo n.º 1
0
    def __init__(self, raiden, asset_address, channel_manager_address,
                 channel_graph):
        """
        Args:
            raiden (RaidenService): a node's service
            asset_address (bin): the asset address managed by this instance
            channel_manager_address (bin): The channel manager address.
            channelgraph (networkx.Graph): a graph representing the raiden network
        """
        if not isaddress(asset_address):
            raise ValueError('asset_address must be a valid address')

        self.partneraddress_channel = dict(
        )  #: maps the partner address to the channel instance
        self.address_channel = dict(
        )  #: maps the channel address to the channel instance
        self.hashlock_channel = defaultdict(
            list)  #: channels that are waiting on the conditional lock

        self.asset_address = asset_address
        self.channel_manager_address = channel_manager_address
        self.channelgraph = channel_graph
        self.raiden = raiden

        transfermanager = TransferManager(self)
        self.transfermanager = transfermanager
Ejemplo n.º 2
0
    def __init__(self, raiden, token_address, channel_manager_address,
                 channel_graph):
        """
        Args:
            raiden (RaidenService): a node's service
            token_address (bin): the token address managed by this instance
            channel_manager_address (bin): The channel manager address.
            channelgraph (networkx.Graph): a graph representing the raiden network
        """
        if not isaddress(token_address):
            raise ValueError('token_address must be a valid address')

        self.partneraddress_channel = dict(
        )  #: maps the partner address to the channel instance
        self.address_channel = dict(
        )  #: maps the channel address to the channel instance

        # This is a map from a hashlock to a list of channels, the same
        # hashlock can be used in more than one TokenManager (for exchanges), a
        # channel should be removed from this list only when the lock is
        # released/withdrawed but not when the secret is registered.
        self.hashlock_channel = defaultdict(
            list)  #: channels waiting on the conditional lock

        self.token_address = token_address
        self.channel_manager_address = channel_manager_address
        self.channelgraph = channel_graph
        self.raiden = raiden

        transfermanager = TransferManager(self)
        self.transfermanager = transfermanager
Ejemplo n.º 3
0
    def __init__(self, raiden, asset_address, channel_graph):
        """
        Args:
            raiden (RaidenService): a node's service
            asset_address (address): the asset address managed by this instance
            channelgraph (networkx.Graph): a graph representing the raiden network
        """
        if not isaddress(asset_address):
            raise ValueError('asset_address must be a valid address')

        self.asset_address = asset_address
        self.channelgraph = channel_graph

        transfermanager = TransferManager(self, raiden)
        self.channels = dict()  #: mapping form partner_address -> channel object
        self.transfermanager = transfermanager  #: handle's raiden transfers