id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
221,700
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
UDPTransport.init_queue_for
def init_queue_for( self, queue_identifier: QueueIdentifier, items: List[QueueItem_T], ) -> NotifyingQueue: """ Create the queue identified by the queue_identifier and initialize it with `items`. """ recipient = queue_identifier.recipient q...
python
def init_queue_for( self, queue_identifier: QueueIdentifier, items: List[QueueItem_T], ) -> NotifyingQueue: """ Create the queue identified by the queue_identifier and initialize it with `items`. """ recipient = queue_identifier.recipient q...
[ "def", "init_queue_for", "(", "self", ",", "queue_identifier", ":", "QueueIdentifier", ",", "items", ":", "List", "[", "QueueItem_T", "]", ",", ")", "->", "NotifyingQueue", ":", "recipient", "=", "queue_identifier", ".", "recipient", "queue", "=", "self", ".",...
Create the queue identified by the queue_identifier and initialize it with `items`.
[ "Create", "the", "queue", "identified", "by", "the", "queue_identifier", "and", "initialize", "it", "with", "items", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L341-L388
221,701
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
UDPTransport.get_queue_for
def get_queue_for( self, queue_identifier: QueueIdentifier, ) -> NotifyingQueue: """ Return the queue identified by the given queue identifier. If the queue doesn't exist it will be instantiated. """ queue = self.queueids_to_queues.get(queue_identifier) ...
python
def get_queue_for( self, queue_identifier: QueueIdentifier, ) -> NotifyingQueue: """ Return the queue identified by the given queue identifier. If the queue doesn't exist it will be instantiated. """ queue = self.queueids_to_queues.get(queue_identifier) ...
[ "def", "get_queue_for", "(", "self", ",", "queue_identifier", ":", "QueueIdentifier", ",", ")", "->", "NotifyingQueue", ":", "queue", "=", "self", ".", "queueids_to_queues", ".", "get", "(", "queue_identifier", ")", "if", "queue", "is", "None", ":", "items", ...
Return the queue identified by the given queue identifier. If the queue doesn't exist it will be instantiated.
[ "Return", "the", "queue", "identified", "by", "the", "given", "queue", "identifier", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L390-L404
221,702
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
UDPTransport.send_async
def send_async( self, queue_identifier: QueueIdentifier, message: Message, ): """ Send a new ordered message to recipient. Messages that use the same `queue_identifier` are ordered. """ recipient = queue_identifier.recipient if not is_bina...
python
def send_async( self, queue_identifier: QueueIdentifier, message: Message, ): """ Send a new ordered message to recipient. Messages that use the same `queue_identifier` are ordered. """ recipient = queue_identifier.recipient if not is_bina...
[ "def", "send_async", "(", "self", ",", "queue_identifier", ":", "QueueIdentifier", ",", "message", ":", "Message", ",", ")", ":", "recipient", "=", "queue_identifier", ".", "recipient", "if", "not", "is_binary_address", "(", "recipient", ")", ":", "raise", "Va...
Send a new ordered message to recipient. Messages that use the same `queue_identifier` are ordered.
[ "Send", "a", "new", "ordered", "message", "to", "recipient", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L406-L445
221,703
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
UDPTransport.receive
def receive( self, messagedata: bytes, host_port: Tuple[str, int], # pylint: disable=unused-argument ) -> bool: """ Handle an UDP packet. """ # pylint: disable=unidiomatic-typecheck if len(messagedata) > self.UDP_MAX_MESSAGE_SIZE: self.log.wa...
python
def receive( self, messagedata: bytes, host_port: Tuple[str, int], # pylint: disable=unused-argument ) -> bool: """ Handle an UDP packet. """ # pylint: disable=unidiomatic-typecheck if len(messagedata) > self.UDP_MAX_MESSAGE_SIZE: self.log.wa...
[ "def", "receive", "(", "self", ",", "messagedata", ":", "bytes", ",", "host_port", ":", "Tuple", "[", "str", ",", "int", "]", ",", "# pylint: disable=unused-argument", ")", "->", "bool", ":", "# pylint: disable=unidiomatic-typecheck", "if", "len", "(", "messaged...
Handle an UDP packet.
[ "Handle", "an", "UDP", "packet", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L506-L550
221,704
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
UDPTransport.receive_message
def receive_message(self, message: Message): """ Handle a Raiden protocol message. The protocol requires durability of the messages. The UDP transport relies on the node's WAL for durability. The message will be converted to a state change, saved to the WAL, and *processed* before the ...
python
def receive_message(self, message: Message): """ Handle a Raiden protocol message. The protocol requires durability of the messages. The UDP transport relies on the node's WAL for durability. The message will be converted to a state change, saved to the WAL, and *processed* before the ...
[ "def", "receive_message", "(", "self", ",", "message", ":", "Message", ")", ":", "self", ".", "raiden", ".", "on_message", "(", "message", ")", "# Sending Delivered after the message is decoded and *processed*", "# gives a stronger guarantee than what is required from a", "# ...
Handle a Raiden protocol message. The protocol requires durability of the messages. The UDP transport relies on the node's WAL for durability. The message will be converted to a state change, saved to the WAL, and *processed* before the durability is confirmed, which is a stronger prope...
[ "Handle", "a", "Raiden", "protocol", "message", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L552-L579
221,705
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
UDPTransport.receive_delivered
def receive_delivered(self, delivered: Delivered): """ Handle a Delivered message. The Delivered message is how the UDP transport guarantees persistence by the partner node. The message itself is not part of the raiden protocol, but it's required by this transport to provide the require...
python
def receive_delivered(self, delivered: Delivered): """ Handle a Delivered message. The Delivered message is how the UDP transport guarantees persistence by the partner node. The message itself is not part of the raiden protocol, but it's required by this transport to provide the require...
[ "def", "receive_delivered", "(", "self", ",", "delivered", ":", "Delivered", ")", ":", "self", ".", "raiden", ".", "on_message", "(", "delivered", ")", "message_id", "=", "delivered", ".", "delivered_message_identifier", "async_result", "=", "self", ".", "raiden...
Handle a Delivered message. The Delivered message is how the UDP transport guarantees persistence by the partner node. The message itself is not part of the raiden protocol, but it's required by this transport to provide the required properties.
[ "Handle", "a", "Delivered", "message", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L581-L602
221,706
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
UDPTransport.receive_ping
def receive_ping(self, ping: Ping): """ Handle a Ping message by answering with a Pong. """ self.log_healthcheck.debug( 'Ping received', message_id=ping.nonce, message=ping, sender=pex(ping.sender), ) pong = Pong(nonce=ping.nonce) ...
python
def receive_ping(self, ping: Ping): """ Handle a Ping message by answering with a Pong. """ self.log_healthcheck.debug( 'Ping received', message_id=ping.nonce, message=ping, sender=pex(ping.sender), ) pong = Pong(nonce=ping.nonce) ...
[ "def", "receive_ping", "(", "self", ",", "ping", ":", "Ping", ")", ":", "self", ".", "log_healthcheck", ".", "debug", "(", "'Ping received'", ",", "message_id", "=", "ping", ".", "nonce", ",", "message", "=", "ping", ",", "sender", "=", "pex", "(", "pi...
Handle a Ping message by answering with a Pong.
[ "Handle", "a", "Ping", "message", "by", "answering", "with", "a", "Pong", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L607-L623
221,707
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
UDPTransport.receive_pong
def receive_pong(self, pong: Pong): """ Handles a Pong message. """ message_id = ('ping', pong.nonce, pong.sender) async_result = self.messageids_to_asyncresults.get(message_id) if async_result is not None: self.log_healthcheck.debug( 'Pong received', ...
python
def receive_pong(self, pong: Pong): """ Handles a Pong message. """ message_id = ('ping', pong.nonce, pong.sender) async_result = self.messageids_to_asyncresults.get(message_id) if async_result is not None: self.log_healthcheck.debug( 'Pong received', ...
[ "def", "receive_pong", "(", "self", ",", "pong", ":", "Pong", ")", ":", "message_id", "=", "(", "'ping'", ",", "pong", ".", "nonce", ",", "pong", ".", "sender", ")", "async_result", "=", "self", ".", "messageids_to_asyncresults", ".", "get", "(", "messag...
Handles a Pong message.
[ "Handles", "a", "Pong", "message", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L625-L644
221,708
raiden-network/raiden
raiden/network/transport/udp/udp_transport.py
UDPTransport.get_ping
def get_ping(self, nonce: Nonce) -> bytes: """ Returns a signed Ping message. Note: Ping messages don't have an enforced ordering, so a Ping message with a higher nonce may be acknowledged first. """ message = Ping( nonce=nonce, current_protocol_version=c...
python
def get_ping(self, nonce: Nonce) -> bytes: """ Returns a signed Ping message. Note: Ping messages don't have an enforced ordering, so a Ping message with a higher nonce may be acknowledged first. """ message = Ping( nonce=nonce, current_protocol_version=c...
[ "def", "get_ping", "(", "self", ",", "nonce", ":", "Nonce", ")", "->", "bytes", ":", "message", "=", "Ping", "(", "nonce", "=", "nonce", ",", "current_protocol_version", "=", "constants", ".", "PROTOCOL_VERSION", ",", ")", "self", ".", "raiden", ".", "si...
Returns a signed Ping message. Note: Ping messages don't have an enforced ordering, so a Ping message with a higher nonce may be acknowledged first.
[ "Returns", "a", "signed", "Ping", "message", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/udp/udp_transport.py#L646-L657
221,709
raiden-network/raiden
raiden/utils/cli.py
apply_config_file
def apply_config_file( command_function: Union[click.Command, click.Group], cli_params: Dict[str, Any], ctx, config_file_option_name='config_file', ): """ Applies all options set in the config file to `cli_params` """ paramname_to_param = {param.name: param for param in command_f...
python
def apply_config_file( command_function: Union[click.Command, click.Group], cli_params: Dict[str, Any], ctx, config_file_option_name='config_file', ): """ Applies all options set in the config file to `cli_params` """ paramname_to_param = {param.name: param for param in command_f...
[ "def", "apply_config_file", "(", "command_function", ":", "Union", "[", "click", ".", "Command", ",", "click", ".", "Group", "]", ",", "cli_params", ":", "Dict", "[", "str", ",", "Any", "]", ",", "ctx", ",", "config_file_option_name", "=", "'config_file'", ...
Applies all options set in the config file to `cli_params`
[ "Applies", "all", "options", "set", "in", "the", "config", "file", "to", "cli_params" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/cli.py#L354-L424
221,710
raiden-network/raiden
raiden/utils/cli.py
get_matrix_servers
def get_matrix_servers(url: str) -> List[str]: """Fetch a list of matrix servers from a text url '-' prefixes (YAML list) are cleaned. Comment lines /^\\s*#/ are ignored url: url of a text file returns: list of urls, default schema is https """ try: response = requests.get(url) ...
python
def get_matrix_servers(url: str) -> List[str]: """Fetch a list of matrix servers from a text url '-' prefixes (YAML list) are cleaned. Comment lines /^\\s*#/ are ignored url: url of a text file returns: list of urls, default schema is https """ try: response = requests.get(url) ...
[ "def", "get_matrix_servers", "(", "url", ":", "str", ")", "->", "List", "[", "str", "]", ":", "try", ":", "response", "=", "requests", ".", "get", "(", "url", ")", "if", "response", ".", "status_code", "!=", "200", ":", "raise", "requests", ".", "Req...
Fetch a list of matrix servers from a text url '-' prefixes (YAML list) are cleaned. Comment lines /^\\s*#/ are ignored url: url of a text file returns: list of urls, default schema is https
[ "Fetch", "a", "list", "of", "matrix", "servers", "from", "a", "text", "url" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/cli.py#L427-L450
221,711
raiden-network/raiden
raiden/raiden_service.py
_redact_secret
def _redact_secret( data: Union[Dict, List], ) -> Union[Dict, List]: """ Modify `data` in-place and replace keys named `secret`. """ if isinstance(data, dict): stack = [data] else: stack = [] while stack: current = stack.pop() if 'secret' in current: ...
python
def _redact_secret( data: Union[Dict, List], ) -> Union[Dict, List]: """ Modify `data` in-place and replace keys named `secret`. """ if isinstance(data, dict): stack = [data] else: stack = [] while stack: current = stack.pop() if 'secret' in current: ...
[ "def", "_redact_secret", "(", "data", ":", "Union", "[", "Dict", ",", "List", "]", ",", ")", "->", "Union", "[", "Dict", ",", "List", "]", ":", "if", "isinstance", "(", "data", ",", "dict", ")", ":", "stack", "=", "[", "data", "]", "else", ":", ...
Modify `data` in-place and replace keys named `secret`.
[ "Modify", "data", "in", "-", "place", "and", "replace", "keys", "named", "secret", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L98-L120
221,712
raiden-network/raiden
raiden/raiden_service.py
RaidenService.stop
def stop(self): """ Stop the node gracefully. Raise if any stop-time error occurred on any subtask """ if self.stop_event.ready(): # not started return # Needs to come before any greenlets joining self.stop_event.set() # Filters must be uninstalled after the alarm ...
python
def stop(self): """ Stop the node gracefully. Raise if any stop-time error occurred on any subtask """ if self.stop_event.ready(): # not started return # Needs to come before any greenlets joining self.stop_event.set() # Filters must be uninstalled after the alarm ...
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "stop_event", ".", "ready", "(", ")", ":", "# not started", "return", "# Needs to come before any greenlets joining", "self", ".", "stop_event", ".", "set", "(", ")", "# Filters must be uninstalled after the a...
Stop the node gracefully. Raise if any stop-time error occurred on any subtask
[ "Stop", "the", "node", "gracefully", ".", "Raise", "if", "any", "stop", "-", "time", "error", "occurred", "on", "any", "subtask" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L576-L605
221,713
raiden-network/raiden
raiden/raiden_service.py
RaidenService._start_transport
def _start_transport(self, chain_state: ChainState): """ Initialize the transport and related facilities. Note: The transport must not be started before the node has caught up with the blockchain through `AlarmTask.first_run()`. This synchronization includes the on-c...
python
def _start_transport(self, chain_state: ChainState): """ Initialize the transport and related facilities. Note: The transport must not be started before the node has caught up with the blockchain through `AlarmTask.first_run()`. This synchronization includes the on-c...
[ "def", "_start_transport", "(", "self", ",", "chain_state", ":", "ChainState", ")", ":", "assert", "self", ".", "alarm", ".", "is_primed", "(", ")", ",", "f'AlarmTask not primed. node:{self!r}'", "assert", "self", ".", "ready_to_process_events", ",", "f'Event procos...
Initialize the transport and related facilities. Note: The transport must not be started before the node has caught up with the blockchain through `AlarmTask.first_run()`. This synchronization includes the on-chain channel state and is necessary to reject new mes...
[ "Initialize", "the", "transport", "and", "related", "facilities", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L628-L648
221,714
raiden-network/raiden
raiden/raiden_service.py
RaidenService.handle_and_track_state_change
def handle_and_track_state_change(self, state_change: StateChange): """ Dispatch the state change and does not handle the exceptions. When the method is used the exceptions are tracked and re-raised in the raiden service thread. """ for greenlet in self.handle_state_change(state...
python
def handle_and_track_state_change(self, state_change: StateChange): """ Dispatch the state change and does not handle the exceptions. When the method is used the exceptions are tracked and re-raised in the raiden service thread. """ for greenlet in self.handle_state_change(state...
[ "def", "handle_and_track_state_change", "(", "self", ",", "state_change", ":", "StateChange", ")", ":", "for", "greenlet", "in", "self", ".", "handle_state_change", "(", "state_change", ")", ":", "self", ".", "add_pending_greenlet", "(", "greenlet", ")" ]
Dispatch the state change and does not handle the exceptions. When the method is used the exceptions are tracked and re-raised in the raiden service thread.
[ "Dispatch", "the", "state", "change", "and", "does", "not", "handle", "the", "exceptions", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L675-L682
221,715
raiden-network/raiden
raiden/raiden_service.py
RaidenService.handle_state_change
def handle_state_change(self, state_change: StateChange) -> List[Greenlet]: """ Dispatch the state change and return the processing threads. Use this for error reporting, failures in the returned greenlets, should be re-raised using `gevent.joinall` with `raise_error=True`. """ ...
python
def handle_state_change(self, state_change: StateChange) -> List[Greenlet]: """ Dispatch the state change and return the processing threads. Use this for error reporting, failures in the returned greenlets, should be re-raised using `gevent.joinall` with `raise_error=True`. """ ...
[ "def", "handle_state_change", "(", "self", ",", "state_change", ":", "StateChange", ")", "->", "List", "[", "Greenlet", "]", ":", "assert", "self", ".", "wal", ",", "f'WAL not restored. node:{self!r}'", "log", ".", "debug", "(", "'State change'", ",", "node", ...
Dispatch the state change and return the processing threads. Use this for error reporting, failures in the returned greenlets, should be re-raised using `gevent.joinall` with `raise_error=True`.
[ "Dispatch", "the", "state", "change", "and", "return", "the", "processing", "threads", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L684-L730
221,716
raiden-network/raiden
raiden/raiden_service.py
RaidenService.handle_event
def handle_event(self, raiden_event: RaidenEvent) -> Greenlet: """Spawn a new thread to handle a Raiden event. This will spawn a new greenlet to handle each event, which is important for two reasons: - Blockchain transactions can be queued without interfering with each other....
python
def handle_event(self, raiden_event: RaidenEvent) -> Greenlet: """Spawn a new thread to handle a Raiden event. This will spawn a new greenlet to handle each event, which is important for two reasons: - Blockchain transactions can be queued without interfering with each other....
[ "def", "handle_event", "(", "self", ",", "raiden_event", ":", "RaidenEvent", ")", "->", "Greenlet", ":", "return", "gevent", ".", "spawn", "(", "self", ".", "_handle_event", ",", "raiden_event", ")" ]
Spawn a new thread to handle a Raiden event. This will spawn a new greenlet to handle each event, which is important for two reasons: - Blockchain transactions can be queued without interfering with each other. - The calling thread is free to do more work. This is specially ...
[ "Spawn", "a", "new", "thread", "to", "handle", "a", "Raiden", "event", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L732-L750
221,717
raiden-network/raiden
raiden/raiden_service.py
RaidenService.start_health_check_for
def start_health_check_for(self, node_address: Address): """Start health checking `node_address`. This function is a noop during initialization, because health checking can be started as a side effect of some events (e.g. new channel). For these cases the healthcheck will be started by ...
python
def start_health_check_for(self, node_address: Address): """Start health checking `node_address`. This function is a noop during initialization, because health checking can be started as a side effect of some events (e.g. new channel). For these cases the healthcheck will be started by ...
[ "def", "start_health_check_for", "(", "self", ",", "node_address", ":", "Address", ")", ":", "if", "self", ".", "transport", ":", "self", ".", "transport", ".", "start_health_check", "(", "node_address", ")" ]
Start health checking `node_address`. This function is a noop during initialization, because health checking can be started as a side effect of some events (e.g. new channel). For these cases the healthcheck will be started by `start_neighbours_healthcheck`.
[ "Start", "health", "checking", "node_address", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L777-L786
221,718
raiden-network/raiden
raiden/raiden_service.py
RaidenService._callback_new_block
def _callback_new_block(self, latest_block: Dict): """Called once a new block is detected by the alarm task. Note: This should be called only once per block, otherwise there will be duplicated `Block` state changes in the log. Therefore this method should be called ...
python
def _callback_new_block(self, latest_block: Dict): """Called once a new block is detected by the alarm task. Note: This should be called only once per block, otherwise there will be duplicated `Block` state changes in the log. Therefore this method should be called ...
[ "def", "_callback_new_block", "(", "self", ",", "latest_block", ":", "Dict", ")", ":", "# User facing APIs, which have on-chain side-effects, force polled the", "# blockchain to update the node's state. This force poll is used to", "# provide a consistent view to the user, e.g. a channel ope...
Called once a new block is detected by the alarm task. Note: This should be called only once per block, otherwise there will be duplicated `Block` state changes in the log. Therefore this method should be called only once a new block is mined with the correspond...
[ "Called", "once", "a", "new", "block", "is", "detected", "by", "the", "alarm", "task", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L788-L842
221,719
raiden-network/raiden
raiden/raiden_service.py
RaidenService._initialize_transactions_queues
def _initialize_transactions_queues(self, chain_state: ChainState): """Initialize the pending transaction queue from the previous run. Note: This will only send the transactions which don't have their side-effects applied. Transactions which another node may have sent ...
python
def _initialize_transactions_queues(self, chain_state: ChainState): """Initialize the pending transaction queue from the previous run. Note: This will only send the transactions which don't have their side-effects applied. Transactions which another node may have sent ...
[ "def", "_initialize_transactions_queues", "(", "self", ",", "chain_state", ":", "ChainState", ")", ":", "assert", "self", ".", "alarm", ".", "is_primed", "(", ")", ",", "f'AlarmTask not primed. node:{self!r}'", "pending_transactions", "=", "views", ".", "get_pending_t...
Initialize the pending transaction queue from the previous run. Note: This will only send the transactions which don't have their side-effects applied. Transactions which another node may have sent already will be detected by the alarm task's first run and cleared ...
[ "Initialize", "the", "pending", "transaction", "queue", "from", "the", "previous", "run", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L844-L878
221,720
raiden-network/raiden
raiden/raiden_service.py
RaidenService._initialize_payment_statuses
def _initialize_payment_statuses(self, chain_state: ChainState): """ Re-initialize targets_to_identifiers_to_statuses. Restore the PaymentStatus for any pending payment. This is not tied to a specific protocol message but to the lifecycle of a payment, i.e. the status is re-created if a...
python
def _initialize_payment_statuses(self, chain_state: ChainState): """ Re-initialize targets_to_identifiers_to_statuses. Restore the PaymentStatus for any pending payment. This is not tied to a specific protocol message but to the lifecycle of a payment, i.e. the status is re-created if a...
[ "def", "_initialize_payment_statuses", "(", "self", ",", "chain_state", ":", "ChainState", ")", ":", "with", "self", ".", "payment_identifier_lock", ":", "for", "task", "in", "chain_state", ".", "payment_mapping", ".", "secrethashes_to_task", ".", "values", "(", "...
Re-initialize targets_to_identifiers_to_statuses. Restore the PaymentStatus for any pending payment. This is not tied to a specific protocol message but to the lifecycle of a payment, i.e. the status is re-created if a payment itself has not completed.
[ "Re", "-", "initialize", "targets_to_identifiers_to_statuses", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L880-L909
221,721
raiden-network/raiden
raiden/raiden_service.py
RaidenService._initialize_messages_queues
def _initialize_messages_queues(self, chain_state: ChainState): """Initialize all the message queues with the transport. Note: All messages from the state queues must be pushed to the transport before it's started. This is necessary to avoid a race where the transpor...
python
def _initialize_messages_queues(self, chain_state: ChainState): """Initialize all the message queues with the transport. Note: All messages from the state queues must be pushed to the transport before it's started. This is necessary to avoid a race where the transpor...
[ "def", "_initialize_messages_queues", "(", "self", ",", "chain_state", ":", "ChainState", ")", ":", "assert", "not", "self", ".", "transport", ",", "f'Transport is running. node:{self!r}'", "assert", "self", ".", "alarm", ".", "is_primed", "(", ")", ",", "f'AlarmT...
Initialize all the message queues with the transport. Note: All messages from the state queues must be pushed to the transport before it's started. This is necessary to avoid a race where the transport processes network messages too quickly, queueing new messages...
[ "Initialize", "all", "the", "message", "queues", "with", "the", "transport", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L911-L936
221,722
raiden-network/raiden
raiden/raiden_service.py
RaidenService._initialize_monitoring_services_queue
def _initialize_monitoring_services_queue(self, chain_state: ChainState): """Send the monitoring requests for all current balance proofs. Note: The node must always send the *received* balance proof to the monitoring service, *before* sending its own locked transfer ...
python
def _initialize_monitoring_services_queue(self, chain_state: ChainState): """Send the monitoring requests for all current balance proofs. Note: The node must always send the *received* balance proof to the monitoring service, *before* sending its own locked transfer ...
[ "def", "_initialize_monitoring_services_queue", "(", "self", ",", "chain_state", ":", "ChainState", ")", ":", "msg", "=", "(", "'Transport was started before the monitoring service queue was updated. '", "'This can lead to safety issue. node:{self!r}'", ")", "assert", "not", "sel...
Send the monitoring requests for all current balance proofs. Note: The node must always send the *received* balance proof to the monitoring service, *before* sending its own locked transfer forward. If the monitoring service is updated after, then the following c...
[ "Send", "the", "monitoring", "requests", "for", "all", "current", "balance", "proofs", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L938-L985
221,723
raiden-network/raiden
raiden/raiden_service.py
RaidenService._initialize_whitelists
def _initialize_whitelists(self, chain_state: ChainState): """ Whitelist neighbors and mediated transfer targets on transport """ for neighbour in views.all_neighbour_nodes(chain_state): if neighbour == ConnectionManager.BOOTSTRAP_ADDR: continue self.transport.wh...
python
def _initialize_whitelists(self, chain_state: ChainState): """ Whitelist neighbors and mediated transfer targets on transport """ for neighbour in views.all_neighbour_nodes(chain_state): if neighbour == ConnectionManager.BOOTSTRAP_ADDR: continue self.transport.wh...
[ "def", "_initialize_whitelists", "(", "self", ",", "chain_state", ":", "ChainState", ")", ":", "for", "neighbour", "in", "views", ".", "all_neighbour_nodes", "(", "chain_state", ")", ":", "if", "neighbour", "==", "ConnectionManager", ".", "BOOTSTRAP_ADDR", ":", ...
Whitelist neighbors and mediated transfer targets on transport
[ "Whitelist", "neighbors", "and", "mediated", "transfer", "targets", "on", "transport" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L987-L1002
221,724
raiden-network/raiden
raiden/raiden_service.py
RaidenService.sign
def sign(self, message: Message): """ Sign message inplace. """ if not isinstance(message, SignedMessage): raise ValueError('{} is not signable.'.format(repr(message))) message.sign(self.signer)
python
def sign(self, message: Message): """ Sign message inplace. """ if not isinstance(message, SignedMessage): raise ValueError('{} is not signable.'.format(repr(message))) message.sign(self.signer)
[ "def", "sign", "(", "self", ",", "message", ":", "Message", ")", ":", "if", "not", "isinstance", "(", "message", ",", "SignedMessage", ")", ":", "raise", "ValueError", "(", "'{} is not signable.'", ".", "format", "(", "repr", "(", "message", ")", ")", ")...
Sign message inplace.
[ "Sign", "message", "inplace", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L1004-L1009
221,725
raiden-network/raiden
raiden/raiden_service.py
RaidenService.mediated_transfer_async
def mediated_transfer_async( self, token_network_identifier: TokenNetworkID, amount: PaymentAmount, target: TargetAddress, identifier: PaymentID, fee: FeeAmount = MEDIATION_FEE, secret: Secret = None, secret_hash: SecretHash...
python
def mediated_transfer_async( self, token_network_identifier: TokenNetworkID, amount: PaymentAmount, target: TargetAddress, identifier: PaymentID, fee: FeeAmount = MEDIATION_FEE, secret: Secret = None, secret_hash: SecretHash...
[ "def", "mediated_transfer_async", "(", "self", ",", "token_network_identifier", ":", "TokenNetworkID", ",", "amount", ":", "PaymentAmount", ",", "target", ":", "TargetAddress", ",", "identifier", ":", "PaymentID", ",", "fee", ":", "FeeAmount", "=", "MEDIATION_FEE", ...
Transfer `amount` between this node and `target`. This method will start an asynchronous transfer, the transfer might fail or succeed depending on a couple of factors: - Existence of a path that can be used, through the usage of direct or intermediary channels. - ...
[ "Transfer", "amount", "between", "this", "node", "and", "target", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/raiden_service.py#L1068-L1104
221,726
raiden-network/raiden
raiden/storage/serialize.py
from_dict_hook
def from_dict_hook(data): """Decode internal objects encoded using `to_dict_hook`. This automatically imports the class defined in the `_type` metadata field, and calls the `from_dict` method hook to instantiate an object of that class. Note: Because this function will do automatic module ...
python
def from_dict_hook(data): """Decode internal objects encoded using `to_dict_hook`. This automatically imports the class defined in the `_type` metadata field, and calls the `from_dict` method hook to instantiate an object of that class. Note: Because this function will do automatic module ...
[ "def", "from_dict_hook", "(", "data", ")", ":", "type_", "=", "data", ".", "get", "(", "'_type'", ",", "None", ")", "if", "type_", "is", "not", "None", ":", "klass", "=", "_import_type", "(", "type_", ")", "msg", "=", "'_type must point to a class with `fr...
Decode internal objects encoded using `to_dict_hook`. This automatically imports the class defined in the `_type` metadata field, and calls the `from_dict` method hook to instantiate an object of that class. Note: Because this function will do automatic module loading it's really impor...
[ "Decode", "internal", "objects", "encoded", "using", "to_dict_hook", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/storage/serialize.py#L27-L48
221,727
raiden-network/raiden
raiden/storage/serialize.py
to_dict_hook
def to_dict_hook(obj): """Convert internal objects to a serializable representation. During serialization if the object has the hook method `to_dict` it will be automatically called and metadata for decoding will be added. This allows for the translation of objects trees of arbitrary depth. E.g.: ...
python
def to_dict_hook(obj): """Convert internal objects to a serializable representation. During serialization if the object has the hook method `to_dict` it will be automatically called and metadata for decoding will be added. This allows for the translation of objects trees of arbitrary depth. E.g.: ...
[ "def", "to_dict_hook", "(", "obj", ")", ":", "if", "hasattr", "(", "obj", ",", "'to_dict'", ")", ":", "result", "=", "obj", ".", "to_dict", "(", ")", "assert", "isinstance", "(", "result", ",", "dict", ")", ",", "'to_dict must return a dictionary'", "resul...
Convert internal objects to a serializable representation. During serialization if the object has the hook method `to_dict` it will be automatically called and metadata for decoding will be added. This allows for the translation of objects trees of arbitrary depth. E.g.: >>> class Root: >>> de...
[ "Convert", "internal", "objects", "to", "a", "serializable", "representation", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/storage/serialize.py#L51-L87
221,728
raiden-network/raiden
tools/debugging/json-log-to-html.py
rgb_color_picker
def rgb_color_picker(obj, min_luminance=None, max_luminance=None): """Modified version of colour.RGB_color_picker""" color_value = int.from_bytes( hashlib.md5(str(obj).encode('utf-8')).digest(), 'little', ) % 0xffffff color = Color(f'#{color_value:06x}') if min_luminance and color.ge...
python
def rgb_color_picker(obj, min_luminance=None, max_luminance=None): """Modified version of colour.RGB_color_picker""" color_value = int.from_bytes( hashlib.md5(str(obj).encode('utf-8')).digest(), 'little', ) % 0xffffff color = Color(f'#{color_value:06x}') if min_luminance and color.ge...
[ "def", "rgb_color_picker", "(", "obj", ",", "min_luminance", "=", "None", ",", "max_luminance", "=", "None", ")", ":", "color_value", "=", "int", ".", "from_bytes", "(", "hashlib", ".", "md5", "(", "str", "(", "obj", ")", ".", "encode", "(", "'utf-8'", ...
Modified version of colour.RGB_color_picker
[ "Modified", "version", "of", "colour", ".", "RGB_color_picker" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/tools/debugging/json-log-to-html.py#L100-L111
221,729
raiden-network/raiden
raiden/utils/__init__.py
random_secret
def random_secret() -> Secret: """ Return a random 32 byte secret except the 0 secret since it's not accepted in the contracts """ while True: secret = os.urandom(32) if secret != constants.EMPTY_HASH: return Secret(secret)
python
def random_secret() -> Secret: """ Return a random 32 byte secret except the 0 secret since it's not accepted in the contracts """ while True: secret = os.urandom(32) if secret != constants.EMPTY_HASH: return Secret(secret)
[ "def", "random_secret", "(", ")", "->", "Secret", ":", "while", "True", ":", "secret", "=", "os", ".", "urandom", "(", "32", ")", "if", "secret", "!=", "constants", ".", "EMPTY_HASH", ":", "return", "Secret", "(", "secret", ")" ]
Return a random 32 byte secret except the 0 secret since it's not accepted in the contracts
[ "Return", "a", "random", "32", "byte", "secret", "except", "the", "0", "secret", "since", "it", "s", "not", "accepted", "in", "the", "contracts" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/__init__.py#L46-L52
221,730
raiden-network/raiden
raiden/utils/__init__.py
address_checksum_and_decode
def address_checksum_and_decode(addr: str) -> Address: """ Accepts a string address and turns it into binary. Makes sure that the string address provided starts is 0x prefixed and checksummed according to EIP55 specification """ if not is_0x_prefixed(addr): raise InvalidAddress('Add...
python
def address_checksum_and_decode(addr: str) -> Address: """ Accepts a string address and turns it into binary. Makes sure that the string address provided starts is 0x prefixed and checksummed according to EIP55 specification """ if not is_0x_prefixed(addr): raise InvalidAddress('Add...
[ "def", "address_checksum_and_decode", "(", "addr", ":", "str", ")", "->", "Address", ":", "if", "not", "is_0x_prefixed", "(", "addr", ")", ":", "raise", "InvalidAddress", "(", "'Address must be 0x prefixed'", ")", "if", "not", "is_checksum_address", "(", "addr", ...
Accepts a string address and turns it into binary. Makes sure that the string address provided starts is 0x prefixed and checksummed according to EIP55 specification
[ "Accepts", "a", "string", "address", "and", "turns", "it", "into", "binary", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/__init__.py#L63-L77
221,731
raiden-network/raiden
raiden/utils/__init__.py
privatekey_to_publickey
def privatekey_to_publickey(private_key_bin: bytes) -> bytes: """ Returns public key in bitcoins 'bin' encoding. """ if not ishash(private_key_bin): raise ValueError('private_key_bin format mismatch. maybe hex encoded?') return keys.PrivateKey(private_key_bin).public_key.to_bytes()
python
def privatekey_to_publickey(private_key_bin: bytes) -> bytes: """ Returns public key in bitcoins 'bin' encoding. """ if not ishash(private_key_bin): raise ValueError('private_key_bin format mismatch. maybe hex encoded?') return keys.PrivateKey(private_key_bin).public_key.to_bytes()
[ "def", "privatekey_to_publickey", "(", "private_key_bin", ":", "bytes", ")", "->", "bytes", ":", "if", "not", "ishash", "(", "private_key_bin", ")", ":", "raise", "ValueError", "(", "'private_key_bin format mismatch. maybe hex encoded?'", ")", "return", "keys", ".", ...
Returns public key in bitcoins 'bin' encoding.
[ "Returns", "public", "key", "in", "bitcoins", "bin", "encoding", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/__init__.py#L120-L124
221,732
raiden-network/raiden
raiden/utils/__init__.py
get_system_spec
def get_system_spec() -> Dict[str, str]: """Collect information about the system and installation. """ import pkg_resources import platform if sys.platform == 'darwin': system_info = 'macOS {} {}'.format( platform.mac_ver()[0], platform.architecture()[0], ) ...
python
def get_system_spec() -> Dict[str, str]: """Collect information about the system and installation. """ import pkg_resources import platform if sys.platform == 'darwin': system_info = 'macOS {} {}'.format( platform.mac_ver()[0], platform.architecture()[0], ) ...
[ "def", "get_system_spec", "(", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "import", "pkg_resources", "import", "platform", "if", "sys", ".", "platform", "==", "'darwin'", ":", "system_info", "=", "'macOS {} {}'", ".", "format", "(", "platform", "...
Collect information about the system and installation.
[ "Collect", "information", "about", "the", "system", "and", "installation", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/__init__.py#L143-L178
221,733
raiden-network/raiden
raiden/utils/__init__.py
safe_gas_limit
def safe_gas_limit(*estimates: int) -> int: """ Calculates a safe gas limit for a number of gas estimates including a security margin """ assert None not in estimates, 'if estimateGas returned None it should not reach here' calculated_limit = max(estimates) return int(calculated_limit * constant...
python
def safe_gas_limit(*estimates: int) -> int: """ Calculates a safe gas limit for a number of gas estimates including a security margin """ assert None not in estimates, 'if estimateGas returned None it should not reach here' calculated_limit = max(estimates) return int(calculated_limit * constant...
[ "def", "safe_gas_limit", "(", "*", "estimates", ":", "int", ")", "->", "int", ":", "assert", "None", "not", "in", "estimates", ",", "'if estimateGas returned None it should not reach here'", "calculated_limit", "=", "max", "(", "estimates", ")", "return", "int", "...
Calculates a safe gas limit for a number of gas estimates including a security margin
[ "Calculates", "a", "safe", "gas", "limit", "for", "a", "number", "of", "gas", "estimates", "including", "a", "security", "margin" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/__init__.py#L253-L259
221,734
raiden-network/raiden
raiden/utils/__init__.py
block_specification_to_number
def block_specification_to_number(block: BlockSpecification, web3: Web3) -> BlockNumber: """ Converts a block specification to an actual block number """ if isinstance(block, str): msg = f"string block specification can't contain {block}" assert block in ('latest', 'pending'), msg number...
python
def block_specification_to_number(block: BlockSpecification, web3: Web3) -> BlockNumber: """ Converts a block specification to an actual block number """ if isinstance(block, str): msg = f"string block specification can't contain {block}" assert block in ('latest', 'pending'), msg number...
[ "def", "block_specification_to_number", "(", "block", ":", "BlockSpecification", ",", "web3", ":", "Web3", ")", "->", "BlockNumber", ":", "if", "isinstance", "(", "block", ",", "str", ")", ":", "msg", "=", "f\"string block specification can't contain {block}\"", "as...
Converts a block specification to an actual block number
[ "Converts", "a", "block", "specification", "to", "an", "actual", "block", "number" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/__init__.py#L267-L281
221,735
raiden-network/raiden
raiden/network/proxies/payment_channel.py
PaymentChannel.detail
def detail(self, block_identifier: BlockSpecification) -> ChannelDetails: """ Returns the channel details. """ return self.token_network.detail( participant1=self.participant1, participant2=self.participant2, block_identifier=block_identifier, channel_iden...
python
def detail(self, block_identifier: BlockSpecification) -> ChannelDetails: """ Returns the channel details. """ return self.token_network.detail( participant1=self.participant1, participant2=self.participant2, block_identifier=block_identifier, channel_iden...
[ "def", "detail", "(", "self", ",", "block_identifier", ":", "BlockSpecification", ")", "->", "ChannelDetails", ":", "return", "self", ".", "token_network", ".", "detail", "(", "participant1", "=", "self", ".", "participant1", ",", "participant2", "=", "self", ...
Returns the channel details.
[ "Returns", "the", "channel", "details", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/payment_channel.py#L71-L78
221,736
raiden-network/raiden
raiden/network/proxies/payment_channel.py
PaymentChannel.settle_timeout
def settle_timeout(self) -> int: """ Returns the channels settle_timeout. """ # There is no way to get the settle timeout after the channel has been closed as # we're saving gas. Therefore get the ChannelOpened event and get the timeout there. filter_args = get_filter_args_for_specific_...
python
def settle_timeout(self) -> int: """ Returns the channels settle_timeout. """ # There is no way to get the settle timeout after the channel has been closed as # we're saving gas. Therefore get the ChannelOpened event and get the timeout there. filter_args = get_filter_args_for_specific_...
[ "def", "settle_timeout", "(", "self", ")", "->", "int", ":", "# There is no way to get the settle timeout after the channel has been closed as", "# we're saving gas. Therefore get the ChannelOpened event and get the timeout there.", "filter_args", "=", "get_filter_args_for_specific_event_fro...
Returns the channels settle_timeout.
[ "Returns", "the", "channels", "settle_timeout", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/payment_channel.py#L80-L100
221,737
raiden-network/raiden
raiden/network/proxies/payment_channel.py
PaymentChannel.opened
def opened(self, block_identifier: BlockSpecification) -> bool: """ Returns if the channel is opened. """ return self.token_network.channel_is_opened( participant1=self.participant1, participant2=self.participant2, block_identifier=block_identifier, channe...
python
def opened(self, block_identifier: BlockSpecification) -> bool: """ Returns if the channel is opened. """ return self.token_network.channel_is_opened( participant1=self.participant1, participant2=self.participant2, block_identifier=block_identifier, channe...
[ "def", "opened", "(", "self", ",", "block_identifier", ":", "BlockSpecification", ")", "->", "bool", ":", "return", "self", ".", "token_network", ".", "channel_is_opened", "(", "participant1", "=", "self", ".", "participant1", ",", "participant2", "=", "self", ...
Returns if the channel is opened.
[ "Returns", "if", "the", "channel", "is", "opened", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/payment_channel.py#L125-L132
221,738
raiden-network/raiden
raiden/network/proxies/payment_channel.py
PaymentChannel.closed
def closed(self, block_identifier: BlockSpecification) -> bool: """ Returns if the channel is closed. """ return self.token_network.channel_is_closed( participant1=self.participant1, participant2=self.participant2, block_identifier=block_identifier, channe...
python
def closed(self, block_identifier: BlockSpecification) -> bool: """ Returns if the channel is closed. """ return self.token_network.channel_is_closed( participant1=self.participant1, participant2=self.participant2, block_identifier=block_identifier, channe...
[ "def", "closed", "(", "self", ",", "block_identifier", ":", "BlockSpecification", ")", "->", "bool", ":", "return", "self", ".", "token_network", ".", "channel_is_closed", "(", "participant1", "=", "self", ".", "participant1", ",", "participant2", "=", "self", ...
Returns if the channel is closed.
[ "Returns", "if", "the", "channel", "is", "closed", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/payment_channel.py#L134-L141
221,739
raiden-network/raiden
raiden/network/proxies/payment_channel.py
PaymentChannel.settled
def settled(self, block_identifier: BlockSpecification) -> bool: """ Returns if the channel is settled. """ return self.token_network.channel_is_settled( participant1=self.participant1, participant2=self.participant2, block_identifier=block_identifier, cha...
python
def settled(self, block_identifier: BlockSpecification) -> bool: """ Returns if the channel is settled. """ return self.token_network.channel_is_settled( participant1=self.participant1, participant2=self.participant2, block_identifier=block_identifier, cha...
[ "def", "settled", "(", "self", ",", "block_identifier", ":", "BlockSpecification", ")", "->", "bool", ":", "return", "self", ".", "token_network", ".", "channel_is_settled", "(", "participant1", "=", "self", ".", "participant1", ",", "participant2", "=", "self",...
Returns if the channel is settled.
[ "Returns", "if", "the", "channel", "is", "settled", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/payment_channel.py#L143-L150
221,740
raiden-network/raiden
raiden/network/proxies/payment_channel.py
PaymentChannel.closing_address
def closing_address(self, block_identifier: BlockSpecification) -> Optional[Address]: """ Returns the address of the closer of the channel. """ return self.token_network.closing_address( participant1=self.participant1, participant2=self.participant2, block_identifier=...
python
def closing_address(self, block_identifier: BlockSpecification) -> Optional[Address]: """ Returns the address of the closer of the channel. """ return self.token_network.closing_address( participant1=self.participant1, participant2=self.participant2, block_identifier=...
[ "def", "closing_address", "(", "self", ",", "block_identifier", ":", "BlockSpecification", ")", "->", "Optional", "[", "Address", "]", ":", "return", "self", ".", "token_network", ".", "closing_address", "(", "participant1", "=", "self", ".", "participant1", ","...
Returns the address of the closer of the channel.
[ "Returns", "the", "address", "of", "the", "closer", "of", "the", "channel", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/payment_channel.py#L152-L159
221,741
raiden-network/raiden
raiden/network/proxies/payment_channel.py
PaymentChannel.close
def close( self, nonce: Nonce, balance_hash: BalanceHash, additional_hash: AdditionalHash, signature: Signature, block_identifier: BlockSpecification, ): """ Closes the channel using the provided balance proof. """ self.token_ne...
python
def close( self, nonce: Nonce, balance_hash: BalanceHash, additional_hash: AdditionalHash, signature: Signature, block_identifier: BlockSpecification, ): """ Closes the channel using the provided balance proof. """ self.token_ne...
[ "def", "close", "(", "self", ",", "nonce", ":", "Nonce", ",", "balance_hash", ":", "BalanceHash", ",", "additional_hash", ":", "AdditionalHash", ",", "signature", ":", "Signature", ",", "block_identifier", ":", "BlockSpecification", ",", ")", ":", "self", ".",...
Closes the channel using the provided balance proof.
[ "Closes", "the", "channel", "using", "the", "provided", "balance", "proof", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/payment_channel.py#L178-L195
221,742
raiden-network/raiden
raiden/network/proxies/payment_channel.py
PaymentChannel.update_transfer
def update_transfer( self, nonce: Nonce, balance_hash: BalanceHash, additional_hash: AdditionalHash, partner_signature: Signature, signature: Signature, block_identifier: BlockSpecification, ): """ Updates the channel using ...
python
def update_transfer( self, nonce: Nonce, balance_hash: BalanceHash, additional_hash: AdditionalHash, partner_signature: Signature, signature: Signature, block_identifier: BlockSpecification, ): """ Updates the channel using ...
[ "def", "update_transfer", "(", "self", ",", "nonce", ":", "Nonce", ",", "balance_hash", ":", "BalanceHash", ",", "additional_hash", ":", "AdditionalHash", ",", "partner_signature", ":", "Signature", ",", "signature", ":", "Signature", ",", "block_identifier", ":",...
Updates the channel using the provided balance proof.
[ "Updates", "the", "channel", "using", "the", "provided", "balance", "proof", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/payment_channel.py#L197-L216
221,743
raiden-network/raiden
raiden/network/proxies/payment_channel.py
PaymentChannel.settle
def settle( self, transferred_amount: TokenAmount, locked_amount: TokenAmount, locksroot: Locksroot, partner_transferred_amount: TokenAmount, partner_locked_amount: TokenAmount, partner_locksroot: Locksroot, block_identifier...
python
def settle( self, transferred_amount: TokenAmount, locked_amount: TokenAmount, locksroot: Locksroot, partner_transferred_amount: TokenAmount, partner_locked_amount: TokenAmount, partner_locksroot: Locksroot, block_identifier...
[ "def", "settle", "(", "self", ",", "transferred_amount", ":", "TokenAmount", ",", "locked_amount", ":", "TokenAmount", ",", "locksroot", ":", "Locksroot", ",", "partner_transferred_amount", ":", "TokenAmount", ",", "partner_locked_amount", ":", "TokenAmount", ",", "...
Settles the channel.
[ "Settles", "the", "channel", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/payment_channel.py#L231-L252
221,744
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator.py
events_for_unlock_lock
def events_for_unlock_lock( initiator_state: InitiatorTransferState, channel_state: NettingChannelState, secret: Secret, secrethash: SecretHash, pseudo_random_generator: random.Random, ) -> List[Event]: """ Unlocks the lock offchain, and emits the events for the successful pa...
python
def events_for_unlock_lock( initiator_state: InitiatorTransferState, channel_state: NettingChannelState, secret: Secret, secrethash: SecretHash, pseudo_random_generator: random.Random, ) -> List[Event]: """ Unlocks the lock offchain, and emits the events for the successful pa...
[ "def", "events_for_unlock_lock", "(", "initiator_state", ":", "InitiatorTransferState", ",", "channel_state", ":", "NettingChannelState", ",", "secret", ":", "Secret", ",", "secrethash", ":", "SecretHash", ",", "pseudo_random_generator", ":", "random", ".", "Random", ...
Unlocks the lock offchain, and emits the events for the successful payment.
[ "Unlocks", "the", "lock", "offchain", "and", "emits", "the", "events", "for", "the", "successful", "payment", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator.py#L49-L84
221,745
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator.py
handle_block
def handle_block( initiator_state: InitiatorTransferState, state_change: Block, channel_state: NettingChannelState, pseudo_random_generator: random.Random, ) -> TransitionResult[InitiatorTransferState]: """ Checks if the lock has expired, and if it has sends a remove expired lock...
python
def handle_block( initiator_state: InitiatorTransferState, state_change: Block, channel_state: NettingChannelState, pseudo_random_generator: random.Random, ) -> TransitionResult[InitiatorTransferState]: """ Checks if the lock has expired, and if it has sends a remove expired lock...
[ "def", "handle_block", "(", "initiator_state", ":", "InitiatorTransferState", ",", "state_change", ":", "Block", ",", "channel_state", ":", "NettingChannelState", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", ")", "->", "TransitionResult", "[", ...
Checks if the lock has expired, and if it has sends a remove expired lock and emits the failing events.
[ "Checks", "if", "the", "lock", "has", "expired", "and", "if", "it", "has", "sends", "a", "remove", "expired", "lock", "and", "emits", "the", "failing", "events", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator.py#L87-L167
221,746
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator.py
next_channel_from_routes
def next_channel_from_routes( available_routes: List[RouteState], channelidentifiers_to_channels: ChannelMap, transfer_amount: PaymentAmount, ) -> Optional[NettingChannelState]: """ Returns the first channel that can be used to start the transfer. The routing service can race with local ...
python
def next_channel_from_routes( available_routes: List[RouteState], channelidentifiers_to_channels: ChannelMap, transfer_amount: PaymentAmount, ) -> Optional[NettingChannelState]: """ Returns the first channel that can be used to start the transfer. The routing service can race with local ...
[ "def", "next_channel_from_routes", "(", "available_routes", ":", "List", "[", "RouteState", "]", ",", "channelidentifiers_to_channels", ":", "ChannelMap", ",", "transfer_amount", ":", "PaymentAmount", ",", ")", "->", "Optional", "[", "NettingChannelState", "]", ":", ...
Returns the first channel that can be used to start the transfer. The routing service can race with local changes, so the recommended routes must be validated.
[ "Returns", "the", "first", "channel", "that", "can", "be", "used", "to", "start", "the", "transfer", ".", "The", "routing", "service", "can", "race", "with", "local", "changes", "so", "the", "recommended", "routes", "must", "be", "validated", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator.py#L178-L211
221,747
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator.py
send_lockedtransfer
def send_lockedtransfer( transfer_description: TransferDescriptionWithSecretState, channel_state: NettingChannelState, message_identifier: MessageID, block_number: BlockNumber, ) -> SendLockedTransfer: """ Create a mediated transfer using channel. """ assert channel_state.token_n...
python
def send_lockedtransfer( transfer_description: TransferDescriptionWithSecretState, channel_state: NettingChannelState, message_identifier: MessageID, block_number: BlockNumber, ) -> SendLockedTransfer: """ Create a mediated transfer using channel. """ assert channel_state.token_n...
[ "def", "send_lockedtransfer", "(", "transfer_description", ":", "TransferDescriptionWithSecretState", ",", "channel_state", ":", "NettingChannelState", ",", "message_identifier", ":", "MessageID", ",", "block_number", ":", "BlockNumber", ",", ")", "->", "SendLockedTransfer"...
Create a mediated transfer using channel.
[ "Create", "a", "mediated", "transfer", "using", "channel", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator.py#L267-L298
221,748
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator.py
handle_offchain_secretreveal
def handle_offchain_secretreveal( initiator_state: InitiatorTransferState, state_change: ReceiveSecretReveal, channel_state: NettingChannelState, pseudo_random_generator: random.Random, ) -> TransitionResult[InitiatorTransferState]: """ Once the next hop proves it knows the secret, t...
python
def handle_offchain_secretreveal( initiator_state: InitiatorTransferState, state_change: ReceiveSecretReveal, channel_state: NettingChannelState, pseudo_random_generator: random.Random, ) -> TransitionResult[InitiatorTransferState]: """ Once the next hop proves it knows the secret, t...
[ "def", "handle_offchain_secretreveal", "(", "initiator_state", ":", "InitiatorTransferState", ",", "state_change", ":", "ReceiveSecretReveal", ",", "channel_state", ":", "NettingChannelState", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", ")", "->", ...
Once the next hop proves it knows the secret, the initiator can unlock the mediated transfer. This will validate the secret, and if valid a new balance proof is sent to the next hop with the current lock removed from the merkle tree and the transferred amount updated.
[ "Once", "the", "next", "hop", "proves", "it", "knows", "the", "secret", "the", "initiator", "can", "unlock", "the", "mediated", "transfer", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator.py#L371-L406
221,749
raiden-network/raiden
raiden/transfer/mediated_transfer/initiator.py
handle_onchain_secretreveal
def handle_onchain_secretreveal( initiator_state: InitiatorTransferState, state_change: ContractReceiveSecretReveal, channel_state: NettingChannelState, pseudo_random_generator: random.Random, ) -> TransitionResult[InitiatorTransferState]: """ When a secret is revealed on-chain all n...
python
def handle_onchain_secretreveal( initiator_state: InitiatorTransferState, state_change: ContractReceiveSecretReveal, channel_state: NettingChannelState, pseudo_random_generator: random.Random, ) -> TransitionResult[InitiatorTransferState]: """ When a secret is revealed on-chain all n...
[ "def", "handle_onchain_secretreveal", "(", "initiator_state", ":", "InitiatorTransferState", ",", "state_change", ":", "ContractReceiveSecretReveal", ",", "channel_state", ":", "NettingChannelState", ",", "pseudo_random_generator", ":", "random", ".", "Random", ",", ")", ...
When a secret is revealed on-chain all nodes learn the secret. This check the on-chain secret corresponds to the one used by the initiator, and if valid a new balance proof is sent to the next hop with the current lock removed from the merkle tree and the transferred amount updated.
[ "When", "a", "secret", "is", "revealed", "on", "-", "chain", "all", "nodes", "learn", "the", "secret", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/initiator.py#L409-L459
221,750
raiden-network/raiden
raiden/transfer/channel.py
is_lock_pending
def is_lock_pending( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> bool: """True if the `secrethash` corresponds to a lock that is pending to be claimed and didn't expire. """ return ( secrethash in end_state.secrethashes_to_lockedlocks or secrethash in ...
python
def is_lock_pending( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> bool: """True if the `secrethash` corresponds to a lock that is pending to be claimed and didn't expire. """ return ( secrethash in end_state.secrethashes_to_lockedlocks or secrethash in ...
[ "def", "is_lock_pending", "(", "end_state", ":", "NettingChannelEndState", ",", "secrethash", ":", "SecretHash", ",", ")", "->", "bool", ":", "return", "(", "secrethash", "in", "end_state", ".", "secrethashes_to_lockedlocks", "or", "secrethash", "in", "end_state", ...
True if the `secrethash` corresponds to a lock that is pending to be claimed and didn't expire.
[ "True", "if", "the", "secrethash", "corresponds", "to", "a", "lock", "that", "is", "pending", "to", "be", "claimed", "and", "didn", "t", "expire", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L156-L167
221,751
raiden-network/raiden
raiden/transfer/channel.py
is_deposit_confirmed
def is_deposit_confirmed( channel_state: NettingChannelState, block_number: BlockNumber, ) -> bool: """True if the block which mined the deposit transaction has been confirmed. """ if not channel_state.deposit_transaction_queue: return False return is_transaction_confirmed( ...
python
def is_deposit_confirmed( channel_state: NettingChannelState, block_number: BlockNumber, ) -> bool: """True if the block which mined the deposit transaction has been confirmed. """ if not channel_state.deposit_transaction_queue: return False return is_transaction_confirmed( ...
[ "def", "is_deposit_confirmed", "(", "channel_state", ":", "NettingChannelState", ",", "block_number", ":", "BlockNumber", ",", ")", "->", "bool", ":", "if", "not", "channel_state", ".", "deposit_transaction_queue", ":", "return", "False", "return", "is_transaction_con...
True if the block which mined the deposit transaction has been confirmed.
[ "True", "if", "the", "block", "which", "mined", "the", "deposit", "transaction", "has", "been", "confirmed", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L170-L183
221,752
raiden-network/raiden
raiden/transfer/channel.py
is_lock_expired
def is_lock_expired( end_state: NettingChannelEndState, lock: LockType, block_number: BlockNumber, lock_expiration_threshold: BlockNumber, ) -> SuccessOrError: """ Determine whether a lock has expired. The lock has expired if both: - The secret was not registered on-cha...
python
def is_lock_expired( end_state: NettingChannelEndState, lock: LockType, block_number: BlockNumber, lock_expiration_threshold: BlockNumber, ) -> SuccessOrError: """ Determine whether a lock has expired. The lock has expired if both: - The secret was not registered on-cha...
[ "def", "is_lock_expired", "(", "end_state", ":", "NettingChannelEndState", ",", "lock", ":", "LockType", ",", "block_number", ":", "BlockNumber", ",", "lock_expiration_threshold", ":", "BlockNumber", ",", ")", "->", "SuccessOrError", ":", "secret_registered_on_chain", ...
Determine whether a lock has expired. The lock has expired if both: - The secret was not registered on-chain in time. - The current block exceeds lock's expiration + confirmation blocks.
[ "Determine", "whether", "a", "lock", "has", "expired", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L194-L219
221,753
raiden-network/raiden
raiden/transfer/channel.py
is_secret_known
def is_secret_known( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> bool: """True if the `secrethash` is for a lock with a known secret.""" return ( secrethash in end_state.secrethashes_to_unlockedlocks or secrethash in end_state.secrethashes_to_onchain_unlockedl...
python
def is_secret_known( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> bool: """True if the `secrethash` is for a lock with a known secret.""" return ( secrethash in end_state.secrethashes_to_unlockedlocks or secrethash in end_state.secrethashes_to_onchain_unlockedl...
[ "def", "is_secret_known", "(", "end_state", ":", "NettingChannelEndState", ",", "secrethash", ":", "SecretHash", ",", ")", "->", "bool", ":", "return", "(", "secrethash", "in", "end_state", ".", "secrethashes_to_unlockedlocks", "or", "secrethash", "in", "end_state",...
True if the `secrethash` is for a lock with a known secret.
[ "True", "if", "the", "secrethash", "is", "for", "a", "lock", "with", "a", "known", "secret", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L237-L245
221,754
raiden-network/raiden
raiden/transfer/channel.py
get_secret
def get_secret( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> Optional[Secret]: """Returns `secret` if the `secrethash` is for a lock with a known secret.""" partial_unlock_proof = end_state.secrethashes_to_unlockedlocks.get(secrethash) if partial_unlock_proof is None: ...
python
def get_secret( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> Optional[Secret]: """Returns `secret` if the `secrethash` is for a lock with a known secret.""" partial_unlock_proof = end_state.secrethashes_to_unlockedlocks.get(secrethash) if partial_unlock_proof is None: ...
[ "def", "get_secret", "(", "end_state", ":", "NettingChannelEndState", ",", "secrethash", ":", "SecretHash", ",", ")", "->", "Optional", "[", "Secret", "]", ":", "partial_unlock_proof", "=", "end_state", ".", "secrethashes_to_unlockedlocks", ".", "get", "(", "secre...
Returns `secret` if the `secrethash` is for a lock with a known secret.
[ "Returns", "secret", "if", "the", "secrethash", "is", "for", "a", "lock", "with", "a", "known", "secret", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L264-L277
221,755
raiden-network/raiden
raiden/transfer/channel.py
is_balance_proof_safe_for_onchain_operations
def is_balance_proof_safe_for_onchain_operations( balance_proof: BalanceProofSignedState, ) -> bool: """ Check if the balance proof would overflow onchain. """ total_amount = balance_proof.transferred_amount + balance_proof.locked_amount return total_amount <= UINT256_MAX
python
def is_balance_proof_safe_for_onchain_operations( balance_proof: BalanceProofSignedState, ) -> bool: """ Check if the balance proof would overflow onchain. """ total_amount = balance_proof.transferred_amount + balance_proof.locked_amount return total_amount <= UINT256_MAX
[ "def", "is_balance_proof_safe_for_onchain_operations", "(", "balance_proof", ":", "BalanceProofSignedState", ",", ")", "->", "bool", ":", "total_amount", "=", "balance_proof", ".", "transferred_amount", "+", "balance_proof", ".", "locked_amount", "return", "total_amount", ...
Check if the balance proof would overflow onchain.
[ "Check", "if", "the", "balance", "proof", "would", "overflow", "onchain", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L288-L293
221,756
raiden-network/raiden
raiden/transfer/channel.py
is_balance_proof_usable_onchain
def is_balance_proof_usable_onchain( received_balance_proof: BalanceProofSignedState, channel_state: NettingChannelState, sender_state: NettingChannelEndState, ) -> SuccessOrError: """ Checks the balance proof can be used on-chain. For a balance proof to be valid it must be newer than t...
python
def is_balance_proof_usable_onchain( received_balance_proof: BalanceProofSignedState, channel_state: NettingChannelState, sender_state: NettingChannelEndState, ) -> SuccessOrError: """ Checks the balance proof can be used on-chain. For a balance proof to be valid it must be newer than t...
[ "def", "is_balance_proof_usable_onchain", "(", "received_balance_proof", ":", "BalanceProofSignedState", ",", "channel_state", ":", "NettingChannelState", ",", "sender_state", ":", "NettingChannelEndState", ",", ")", "->", "SuccessOrError", ":", "expected_nonce", "=", "get_...
Checks the balance proof can be used on-chain. For a balance proof to be valid it must be newer than the previous one, i.e. the nonce must increase, the signature must tie the balance proof to the correct channel, and the values must not result in an under/overflow onchain. Important: This predica...
[ "Checks", "the", "balance", "proof", "can", "be", "used", "on", "-", "chain", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L368-L462
221,757
raiden-network/raiden
raiden/transfer/channel.py
get_distributable
def get_distributable( sender: NettingChannelEndState, receiver: NettingChannelEndState, ) -> TokenAmount: """Return the amount of tokens that can be used by the `sender`. The returned value is limited to a UINT256, since that is the representation used in the smart contracts and we cannot ...
python
def get_distributable( sender: NettingChannelEndState, receiver: NettingChannelEndState, ) -> TokenAmount: """Return the amount of tokens that can be used by the `sender`. The returned value is limited to a UINT256, since that is the representation used in the smart contracts and we cannot ...
[ "def", "get_distributable", "(", "sender", ":", "NettingChannelEndState", ",", "receiver", ":", "NettingChannelEndState", ",", ")", "->", "TokenAmount", ":", "_", ",", "_", ",", "transferred_amount", ",", "locked_amount", "=", "get_current_balanceproof", "(", "sende...
Return the amount of tokens that can be used by the `sender`. The returned value is limited to a UINT256, since that is the representation used in the smart contracts and we cannot use a larger value. The limit is enforced on transferred_amount + locked_amount to avoid overflows. This is an additional ...
[ "Return", "the", "amount", "of", "tokens", "that", "can", "be", "used", "by", "the", "sender", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L950-L970
221,758
raiden-network/raiden
raiden/transfer/channel.py
get_batch_unlock
def get_batch_unlock( end_state: NettingChannelEndState, ) -> Optional[MerkleTreeLeaves]: """ Unlock proof for an entire merkle tree of pending locks The unlock proof contains all the merkle tree data, tightly packed, needed by the token network contract to verify the secret expiry and calculate th...
python
def get_batch_unlock( end_state: NettingChannelEndState, ) -> Optional[MerkleTreeLeaves]: """ Unlock proof for an entire merkle tree of pending locks The unlock proof contains all the merkle tree data, tightly packed, needed by the token network contract to verify the secret expiry and calculate th...
[ "def", "get_batch_unlock", "(", "end_state", ":", "NettingChannelEndState", ",", ")", "->", "Optional", "[", "MerkleTreeLeaves", "]", ":", "if", "len", "(", "end_state", ".", "merkletree", ".", "layers", "[", "LEAVES", "]", ")", "==", "0", ":", "# pylint: di...
Unlock proof for an entire merkle tree of pending locks The unlock proof contains all the merkle tree data, tightly packed, needed by the token network contract to verify the secret expiry and calculate the token amounts to transfer.
[ "Unlock", "proof", "for", "an", "entire", "merkle", "tree", "of", "pending", "locks" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L973-L1007
221,759
raiden-network/raiden
raiden/transfer/channel.py
get_lock
def get_lock( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> Optional[HashTimeLockState]: """Return the lock correspoding to `secrethash` or None if the lock is unknown. """ lock = end_state.secrethashes_to_lockedlocks.get(secrethash) if not lock: partial_un...
python
def get_lock( end_state: NettingChannelEndState, secrethash: SecretHash, ) -> Optional[HashTimeLockState]: """Return the lock correspoding to `secrethash` or None if the lock is unknown. """ lock = end_state.secrethashes_to_lockedlocks.get(secrethash) if not lock: partial_un...
[ "def", "get_lock", "(", "end_state", ":", "NettingChannelEndState", ",", "secrethash", ":", "SecretHash", ",", ")", "->", "Optional", "[", "HashTimeLockState", "]", ":", "lock", "=", "end_state", ".", "secrethashes_to_lockedlocks", ".", "get", "(", "secrethash", ...
Return the lock correspoding to `secrethash` or None if the lock is unknown.
[ "Return", "the", "lock", "correspoding", "to", "secrethash", "or", "None", "if", "the", "lock", "is", "unknown", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1010-L1029
221,760
raiden-network/raiden
raiden/transfer/channel.py
lock_exists_in_either_channel_side
def lock_exists_in_either_channel_side( channel_state: NettingChannelState, secrethash: SecretHash, ) -> bool: """Check if the lock with `secrethash` exists in either our state or the partner's state""" lock = get_lock(channel_state.our_state, secrethash) if not lock: lock = get_lock...
python
def lock_exists_in_either_channel_side( channel_state: NettingChannelState, secrethash: SecretHash, ) -> bool: """Check if the lock with `secrethash` exists in either our state or the partner's state""" lock = get_lock(channel_state.our_state, secrethash) if not lock: lock = get_lock...
[ "def", "lock_exists_in_either_channel_side", "(", "channel_state", ":", "NettingChannelState", ",", "secrethash", ":", "SecretHash", ",", ")", "->", "bool", ":", "lock", "=", "get_lock", "(", "channel_state", ".", "our_state", ",", "secrethash", ")", "if", "not", ...
Check if the lock with `secrethash` exists in either our state or the partner's state
[ "Check", "if", "the", "lock", "with", "secrethash", "exists", "in", "either", "our", "state", "or", "the", "partner", "s", "state" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1032-L1040
221,761
raiden-network/raiden
raiden/transfer/channel.py
_del_lock
def _del_lock(end_state: NettingChannelEndState, secrethash: SecretHash) -> None: """Removes the lock from the indexing structures. Note: This won't change the merkletree! """ assert is_lock_pending(end_state, secrethash) _del_unclaimed_lock(end_state, secrethash) if secrethash in end...
python
def _del_lock(end_state: NettingChannelEndState, secrethash: SecretHash) -> None: """Removes the lock from the indexing structures. Note: This won't change the merkletree! """ assert is_lock_pending(end_state, secrethash) _del_unclaimed_lock(end_state, secrethash) if secrethash in end...
[ "def", "_del_lock", "(", "end_state", ":", "NettingChannelEndState", ",", "secrethash", ":", "SecretHash", ")", "->", "None", ":", "assert", "is_lock_pending", "(", "end_state", ",", "secrethash", ")", "_del_unclaimed_lock", "(", "end_state", ",", "secrethash", ")...
Removes the lock from the indexing structures. Note: This won't change the merkletree!
[ "Removes", "the", "lock", "from", "the", "indexing", "structures", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1103-L1114
221,762
raiden-network/raiden
raiden/transfer/channel.py
compute_merkletree_with
def compute_merkletree_with( merkletree: MerkleTreeState, lockhash: LockHash, ) -> Optional[MerkleTreeState]: """Register the given lockhash with the existing merkle tree.""" # Use None to inform the caller the lockshash is already known result = None leaves = merkletree.layers[LEAVES] ...
python
def compute_merkletree_with( merkletree: MerkleTreeState, lockhash: LockHash, ) -> Optional[MerkleTreeState]: """Register the given lockhash with the existing merkle tree.""" # Use None to inform the caller the lockshash is already known result = None leaves = merkletree.layers[LEAVES] ...
[ "def", "compute_merkletree_with", "(", "merkletree", ":", "MerkleTreeState", ",", "lockhash", ":", "LockHash", ",", ")", "->", "Optional", "[", "MerkleTreeState", "]", ":", "# Use None to inform the caller the lockshash is already known", "result", "=", "None", "leaves", ...
Register the given lockhash with the existing merkle tree.
[ "Register", "the", "given", "lockhash", "with", "the", "existing", "merkle", "tree", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1172-L1186
221,763
raiden-network/raiden
raiden/transfer/channel.py
register_offchain_secret
def register_offchain_secret( channel_state: NettingChannelState, secret: Secret, secrethash: SecretHash, ) -> None: """This will register the secret and set the lock to the unlocked stated. Even though the lock is unlock it is *not* claimed. The capacity will increase once the next...
python
def register_offchain_secret( channel_state: NettingChannelState, secret: Secret, secrethash: SecretHash, ) -> None: """This will register the secret and set the lock to the unlocked stated. Even though the lock is unlock it is *not* claimed. The capacity will increase once the next...
[ "def", "register_offchain_secret", "(", "channel_state", ":", "NettingChannelState", ",", "secret", ":", "Secret", ",", "secrethash", ":", "SecretHash", ",", ")", "->", "None", ":", "our_state", "=", "channel_state", ".", "our_state", "partner_state", "=", "channe...
This will register the secret and set the lock to the unlocked stated. Even though the lock is unlock it is *not* claimed. The capacity will increase once the next balance proof is received.
[ "This", "will", "register", "the", "secret", "and", "set", "the", "lock", "to", "the", "unlocked", "stated", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1590-L1604
221,764
raiden-network/raiden
raiden/transfer/channel.py
register_onchain_secret
def register_onchain_secret( channel_state: NettingChannelState, secret: Secret, secrethash: SecretHash, secret_reveal_block_number: BlockNumber, delete_lock: bool = True, ) -> None: """This will register the onchain secret and set the lock to the unlocked stated. Even t...
python
def register_onchain_secret( channel_state: NettingChannelState, secret: Secret, secrethash: SecretHash, secret_reveal_block_number: BlockNumber, delete_lock: bool = True, ) -> None: """This will register the onchain secret and set the lock to the unlocked stated. Even t...
[ "def", "register_onchain_secret", "(", "channel_state", ":", "NettingChannelState", ",", "secret", ":", "Secret", ",", "secrethash", ":", "SecretHash", ",", "secret_reveal_block_number", ":", "BlockNumber", ",", "delete_lock", ":", "bool", "=", "True", ",", ")", "...
This will register the onchain secret and set the lock to the unlocked stated. Even though the lock is unlocked it is *not* claimed. The capacity will increase once the next balance proof is received.
[ "This", "will", "register", "the", "onchain", "secret", "and", "set", "the", "lock", "to", "the", "unlocked", "stated", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1607-L1635
221,765
raiden-network/raiden
raiden/transfer/channel.py
handle_receive_lockedtransfer
def handle_receive_lockedtransfer( channel_state: NettingChannelState, mediated_transfer: LockedTransferSignedState, ) -> EventsOrError: """Register the latest known transfer. The receiver needs to use this method to update the container with a _valid_ transfer, otherwise the locksroot will...
python
def handle_receive_lockedtransfer( channel_state: NettingChannelState, mediated_transfer: LockedTransferSignedState, ) -> EventsOrError: """Register the latest known transfer. The receiver needs to use this method to update the container with a _valid_ transfer, otherwise the locksroot will...
[ "def", "handle_receive_lockedtransfer", "(", "channel_state", ":", "NettingChannelState", ",", "mediated_transfer", ":", "LockedTransferSignedState", ",", ")", "->", "EventsOrError", ":", "events", ":", "List", "[", "Event", "]", "is_valid", ",", "msg", ",", "merkle...
Register the latest known transfer. The receiver needs to use this method to update the container with a _valid_ transfer, otherwise the locksroot will not contain the pending transfer. The receiver needs to ensure that the merkle root has the secrethash included, otherwise it won't be able to claim it...
[ "Register", "the", "latest", "known", "transfer", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/channel.py#L1742-L1783
221,766
raiden-network/raiden
raiden/utils/notifying_queue.py
NotifyingQueue.get
def get(self, block=True, timeout=None): """ Removes and returns an item from the queue. """ value = self._queue.get(block, timeout) if self._queue.empty(): self.clear() return value
python
def get(self, block=True, timeout=None): """ Removes and returns an item from the queue. """ value = self._queue.get(block, timeout) if self._queue.empty(): self.clear() return value
[ "def", "get", "(", "self", ",", "block", "=", "True", ",", "timeout", "=", "None", ")", ":", "value", "=", "self", ".", "_queue", ".", "get", "(", "block", ",", "timeout", ")", "if", "self", ".", "_queue", ".", "empty", "(", ")", ":", "self", "...
Removes and returns an item from the queue.
[ "Removes", "and", "returns", "an", "item", "from", "the", "queue", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/notifying_queue.py#L18-L23
221,767
raiden-network/raiden
raiden/utils/notifying_queue.py
NotifyingQueue.copy
def copy(self): """ Copies the current queue items. """ copy = self._queue.copy() result = list() while not copy.empty(): result.append(copy.get_nowait()) return result
python
def copy(self): """ Copies the current queue items. """ copy = self._queue.copy() result = list() while not copy.empty(): result.append(copy.get_nowait()) return result
[ "def", "copy", "(", "self", ")", ":", "copy", "=", "self", ".", "_queue", ".", "copy", "(", ")", "result", "=", "list", "(", ")", "while", "not", "copy", ".", "empty", "(", ")", ":", "result", ".", "append", "(", "copy", ".", "get_nowait", "(", ...
Copies the current queue items.
[ "Copies", "the", "current", "queue", "items", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/notifying_queue.py#L31-L38
221,768
raiden-network/raiden
raiden/routing.py
get_best_routes_internal
def get_best_routes_internal( chain_state: ChainState, token_network_id: TokenNetworkID, from_address: InitiatorAddress, to_address: TargetAddress, amount: int, previous_address: Optional[Address], ) -> List[RouteState]: """ Returns a list of channels that can be used...
python
def get_best_routes_internal( chain_state: ChainState, token_network_id: TokenNetworkID, from_address: InitiatorAddress, to_address: TargetAddress, amount: int, previous_address: Optional[Address], ) -> List[RouteState]: """ Returns a list of channels that can be used...
[ "def", "get_best_routes_internal", "(", "chain_state", ":", "ChainState", ",", "token_network_id", ":", "TokenNetworkID", ",", "from_address", ":", "InitiatorAddress", ",", "to_address", ":", "TargetAddress", ",", "amount", ":", "int", ",", "previous_address", ":", ...
Returns a list of channels that can be used to make a transfer. This will filter out channels that are not open and don't have enough capacity.
[ "Returns", "a", "list", "of", "channels", "that", "can", "be", "used", "to", "make", "a", "transfer", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/routing.py#L80-L174
221,769
raiden-network/raiden
raiden/network/transport/matrix/client.py
Room.get_joined_members
def get_joined_members(self, force_resync=False) -> List[User]: """ Return a list of members of this room. """ if force_resync: response = self.client.api.get_room_members(self.room_id) for event in response['chunk']: if event['content']['membership'] == 'join': ...
python
def get_joined_members(self, force_resync=False) -> List[User]: """ Return a list of members of this room. """ if force_resync: response = self.client.api.get_room_members(self.room_id) for event in response['chunk']: if event['content']['membership'] == 'join': ...
[ "def", "get_joined_members", "(", "self", ",", "force_resync", "=", "False", ")", "->", "List", "[", "User", "]", ":", "if", "force_resync", ":", "response", "=", "self", ".", "client", ".", "api", ".", "get_room_members", "(", "self", ".", "room_id", ")...
Return a list of members of this room.
[ "Return", "a", "list", "of", "members", "of", "this", "room", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L31-L46
221,770
raiden-network/raiden
raiden/network/transport/matrix/client.py
Room.update_aliases
def update_aliases(self): """ Get aliases information from room state Returns: boolean: True if the aliases changed, False if not """ changed = False try: response = self.client.api.get_room_state(self.room_id) except MatrixRequestError: ...
python
def update_aliases(self): """ Get aliases information from room state Returns: boolean: True if the aliases changed, False if not """ changed = False try: response = self.client.api.get_room_state(self.room_id) except MatrixRequestError: ...
[ "def", "update_aliases", "(", "self", ")", ":", "changed", "=", "False", "try", ":", "response", "=", "self", ".", "client", ".", "api", ".", "get_room_state", "(", "self", ".", "room_id", ")", "except", "MatrixRequestError", ":", "return", "False", "for",...
Get aliases information from room state Returns: boolean: True if the aliases changed, False if not
[ "Get", "aliases", "information", "from", "room", "state" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L60-L86
221,771
raiden-network/raiden
raiden/network/transport/matrix/client.py
GMatrixClient.stop_listener_thread
def stop_listener_thread(self): """ Kills sync_thread greenlet before joining it """ # when stopping, `kill` will cause the `self.api.sync` call in _sync # to raise a connection error. This flag will ensure it exits gracefully then self.should_listen = False if self.sync_thread: ...
python
def stop_listener_thread(self): """ Kills sync_thread greenlet before joining it """ # when stopping, `kill` will cause the `self.api.sync` call in _sync # to raise a connection error. This flag will ensure it exits gracefully then self.should_listen = False if self.sync_thread: ...
[ "def", "stop_listener_thread", "(", "self", ")", ":", "# when stopping, `kill` will cause the `self.api.sync` call in _sync", "# to raise a connection error. This flag will ensure it exits gracefully then", "self", ".", "should_listen", "=", "False", "if", "self", ".", "sync_thread",...
Kills sync_thread greenlet before joining it
[ "Kills", "sync_thread", "greenlet", "before", "joining", "it" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L267-L278
221,772
raiden-network/raiden
raiden/network/transport/matrix/client.py
GMatrixClient.typing
def typing(self, room: Room, timeout: int = 5000): """ Send typing event directly to api Args: room: room to send typing event to timeout: timeout for the event, in ms """ path = f'/rooms/{quote(room.room_id)}/typing/{quote(self.user_id)}' return ...
python
def typing(self, room: Room, timeout: int = 5000): """ Send typing event directly to api Args: room: room to send typing event to timeout: timeout for the event, in ms """ path = f'/rooms/{quote(room.room_id)}/typing/{quote(self.user_id)}' return ...
[ "def", "typing", "(", "self", ",", "room", ":", "Room", ",", "timeout", ":", "int", "=", "5000", ")", ":", "path", "=", "f'/rooms/{quote(room.room_id)}/typing/{quote(self.user_id)}'", "return", "self", ".", "api", ".", "_send", "(", "'PUT'", ",", "path", ","...
Send typing event directly to api Args: room: room to send typing event to timeout: timeout for the event, in ms
[ "Send", "typing", "event", "directly", "to", "api" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L362-L371
221,773
raiden-network/raiden
raiden/network/transport/matrix/client.py
GMatrixClient._mkroom
def _mkroom(self, room_id: str) -> Room: """ Uses a geventified Room subclass """ if room_id not in self.rooms: self.rooms[room_id] = Room(self, room_id) room = self.rooms[room_id] if not room.canonical_alias: room.update_aliases() return room
python
def _mkroom(self, room_id: str) -> Room: """ Uses a geventified Room subclass """ if room_id not in self.rooms: self.rooms[room_id] = Room(self, room_id) room = self.rooms[room_id] if not room.canonical_alias: room.update_aliases() return room
[ "def", "_mkroom", "(", "self", ",", "room_id", ":", "str", ")", "->", "Room", ":", "if", "room_id", "not", "in", "self", ".", "rooms", ":", "self", ".", "rooms", "[", "room_id", "]", "=", "Room", "(", "self", ",", "room_id", ")", "room", "=", "se...
Uses a geventified Room subclass
[ "Uses", "a", "geventified", "Room", "subclass" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L373-L380
221,774
raiden-network/raiden
raiden/network/transport/matrix/client.py
GMatrixClient.set_sync_limit
def set_sync_limit(self, limit: int) -> Optional[int]: """ Sets the events limit per room for sync and return previous limit """ try: prev_limit = json.loads(self.sync_filter)['room']['timeline']['limit'] except (json.JSONDecodeError, KeyError): prev_limit = None ...
python
def set_sync_limit(self, limit: int) -> Optional[int]: """ Sets the events limit per room for sync and return previous limit """ try: prev_limit = json.loads(self.sync_filter)['room']['timeline']['limit'] except (json.JSONDecodeError, KeyError): prev_limit = None ...
[ "def", "set_sync_limit", "(", "self", ",", "limit", ":", "int", ")", "->", "Optional", "[", "int", "]", ":", "try", ":", "prev_limit", "=", "json", ".", "loads", "(", "self", ".", "sync_filter", ")", "[", "'room'", "]", "[", "'timeline'", "]", "[", ...
Sets the events limit per room for sync and return previous limit
[ "Sets", "the", "events", "limit", "per", "room", "for", "sync", "and", "return", "previous", "limit" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L491-L498
221,775
raiden-network/raiden
raiden/api/rest.py
handle_request_parsing_error
def handle_request_parsing_error( err, _req, _schema, _err_status_code, _err_headers, ): """ This handles request parsing errors generated for example by schema field validation failing.""" abort(HTTPStatus.BAD_REQUEST, errors=err.messages)
python
def handle_request_parsing_error( err, _req, _schema, _err_status_code, _err_headers, ): """ This handles request parsing errors generated for example by schema field validation failing.""" abort(HTTPStatus.BAD_REQUEST, errors=err.messages)
[ "def", "handle_request_parsing_error", "(", "err", ",", "_req", ",", "_schema", ",", "_err_status_code", ",", "_err_headers", ",", ")", ":", "abort", "(", "HTTPStatus", ".", "BAD_REQUEST", ",", "errors", "=", "err", ".", "messages", ")" ]
This handles request parsing errors generated for example by schema field validation failing.
[ "This", "handles", "request", "parsing", "errors", "generated", "for", "example", "by", "schema", "field", "validation", "failing", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/rest.py#L230-L239
221,776
raiden-network/raiden
raiden/api/rest.py
hexbytes_to_str
def hexbytes_to_str(map_: Dict): """ Converts values that are of type `HexBytes` to strings. """ for k, v in map_.items(): if isinstance(v, HexBytes): map_[k] = encode_hex(v)
python
def hexbytes_to_str(map_: Dict): """ Converts values that are of type `HexBytes` to strings. """ for k, v in map_.items(): if isinstance(v, HexBytes): map_[k] = encode_hex(v)
[ "def", "hexbytes_to_str", "(", "map_", ":", "Dict", ")", ":", "for", "k", ",", "v", "in", "map_", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "HexBytes", ")", ":", "map_", "[", "k", "]", "=", "encode_hex", "(", "v", ")" ]
Converts values that are of type `HexBytes` to strings.
[ "Converts", "values", "that", "are", "of", "type", "HexBytes", "to", "strings", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/rest.py#L249-L253
221,777
raiden-network/raiden
raiden/api/rest.py
encode_byte_values
def encode_byte_values(map_: Dict): """ Converts values that are of type `bytes` to strings. """ for k, v in map_.items(): if isinstance(v, bytes): map_[k] = encode_hex(v)
python
def encode_byte_values(map_: Dict): """ Converts values that are of type `bytes` to strings. """ for k, v in map_.items(): if isinstance(v, bytes): map_[k] = encode_hex(v)
[ "def", "encode_byte_values", "(", "map_", ":", "Dict", ")", ":", "for", "k", ",", "v", "in", "map_", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "bytes", ")", ":", "map_", "[", "k", "]", "=", "encode_hex", "(", "v", ")" ]
Converts values that are of type `bytes` to strings.
[ "Converts", "values", "that", "are", "of", "type", "bytes", "to", "strings", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/rest.py#L256-L260
221,778
raiden-network/raiden
raiden/api/rest.py
normalize_events_list
def normalize_events_list(old_list): """Internally the `event_type` key is prefixed with underscore but the API returns an object without that prefix""" new_list = [] for _event in old_list: new_event = dict(_event) if new_event.get('args'): new_event['args'] = dict(new_event...
python
def normalize_events_list(old_list): """Internally the `event_type` key is prefixed with underscore but the API returns an object without that prefix""" new_list = [] for _event in old_list: new_event = dict(_event) if new_event.get('args'): new_event['args'] = dict(new_event...
[ "def", "normalize_events_list", "(", "old_list", ")", ":", "new_list", "=", "[", "]", "for", "_event", "in", "old_list", ":", "new_event", "=", "dict", "(", "_event", ")", "if", "new_event", ".", "get", "(", "'args'", ")", ":", "new_event", "[", "'args'"...
Internally the `event_type` key is prefixed with underscore but the API returns an object without that prefix
[ "Internally", "the", "event_type", "key", "is", "prefixed", "with", "underscore", "but", "the", "API", "returns", "an", "object", "without", "that", "prefix" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/rest.py#L271-L296
221,779
raiden-network/raiden
raiden/api/rest.py
APIServer.unhandled_exception
def unhandled_exception(self, exception: Exception): """ Flask.errorhandler when an exception wasn't correctly handled """ log.critical( 'Unhandled exception when processing endpoint request', exc_info=True, node=pex(self.rest_api.raiden_api.address), ) ...
python
def unhandled_exception(self, exception: Exception): """ Flask.errorhandler when an exception wasn't correctly handled """ log.critical( 'Unhandled exception when processing endpoint request', exc_info=True, node=pex(self.rest_api.raiden_api.address), ) ...
[ "def", "unhandled_exception", "(", "self", ",", "exception", ":", "Exception", ")", ":", "log", ".", "critical", "(", "'Unhandled exception when processing endpoint request'", ",", "exc_info", "=", "True", ",", "node", "=", "pex", "(", "self", ".", "rest_api", "...
Flask.errorhandler when an exception wasn't correctly handled
[ "Flask", ".", "errorhandler", "when", "an", "exception", "wasn", "t", "correctly", "handled" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/rest.py#L540-L548
221,780
raiden-network/raiden
raiden/api/rest.py
RestAPI.get_connection_managers_info
def get_connection_managers_info(self, registry_address: typing.PaymentNetworkID): """Get a dict whose keys are token addresses and whose values are open channels, funds of last request, sum of deposits and number of channels""" log.debug( 'Getting connection managers info', ...
python
def get_connection_managers_info(self, registry_address: typing.PaymentNetworkID): """Get a dict whose keys are token addresses and whose values are open channels, funds of last request, sum of deposits and number of channels""" log.debug( 'Getting connection managers info', ...
[ "def", "get_connection_managers_info", "(", "self", ",", "registry_address", ":", "typing", ".", "PaymentNetworkID", ")", ":", "log", ".", "debug", "(", "'Getting connection managers info'", ",", "node", "=", "pex", "(", "self", ".", "raiden_api", ".", "address", ...
Get a dict whose keys are token addresses and whose values are open channels, funds of last request, sum of deposits and number of channels
[ "Get", "a", "dict", "whose", "keys", "are", "token", "addresses", "and", "whose", "values", "are", "open", "channels", "funds", "of", "last", "request", "sum", "of", "deposits", "and", "number", "of", "channels" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/api/rest.py#L788-L828
221,781
raiden-network/raiden
raiden/ui/startup.py
setup_network_id_or_exit
def setup_network_id_or_exit( config: Dict[str, Any], given_network_id: int, web3: Web3, ) -> Tuple[int, bool]: """ Takes the given network id and checks it against the connected network If they don't match, exits the program with an error. If they do adds it to the configuratio...
python
def setup_network_id_or_exit( config: Dict[str, Any], given_network_id: int, web3: Web3, ) -> Tuple[int, bool]: """ Takes the given network id and checks it against the connected network If they don't match, exits the program with an error. If they do adds it to the configuratio...
[ "def", "setup_network_id_or_exit", "(", "config", ":", "Dict", "[", "str", ",", "Any", "]", ",", "given_network_id", ":", "int", ",", "web3", ":", "Web3", ",", ")", "->", "Tuple", "[", "int", ",", "bool", "]", ":", "node_network_id", "=", "int", "(", ...
Takes the given network id and checks it against the connected network If they don't match, exits the program with an error. If they do adds it to the configuration and then returns it and whether it is a known network
[ "Takes", "the", "given", "network", "id", "and", "checks", "it", "against", "the", "connected", "network" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/ui/startup.py#L46-L79
221,782
raiden-network/raiden
raiden/ui/startup.py
setup_environment
def setup_environment(config: Dict[str, Any], environment_type: Environment) -> None: """Sets the config depending on the environment type""" # interpret the provided string argument if environment_type == Environment.PRODUCTION: # Safe configuration: restrictions for mainnet apply and matrix rooms ...
python
def setup_environment(config: Dict[str, Any], environment_type: Environment) -> None: """Sets the config depending on the environment type""" # interpret the provided string argument if environment_type == Environment.PRODUCTION: # Safe configuration: restrictions for mainnet apply and matrix rooms ...
[ "def", "setup_environment", "(", "config", ":", "Dict", "[", "str", ",", "Any", "]", ",", "environment_type", ":", "Environment", ")", "->", "None", ":", "# interpret the provided string argument", "if", "environment_type", "==", "Environment", ".", "PRODUCTION", ...
Sets the config depending on the environment type
[ "Sets", "the", "config", "depending", "on", "the", "environment", "type" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/ui/startup.py#L82-L91
221,783
raiden-network/raiden
raiden/ui/startup.py
setup_contracts_or_exit
def setup_contracts_or_exit( config: Dict[str, Any], network_id: int, ) -> Dict[str, Any]: """Sets the contract deployment data depending on the network id and environment type If an invalid combination of network id and environment type is provided, exits the program with an error """ ...
python
def setup_contracts_or_exit( config: Dict[str, Any], network_id: int, ) -> Dict[str, Any]: """Sets the contract deployment data depending on the network id and environment type If an invalid combination of network id and environment type is provided, exits the program with an error """ ...
[ "def", "setup_contracts_or_exit", "(", "config", ":", "Dict", "[", "str", ",", "Any", "]", ",", "network_id", ":", "int", ",", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "environment_type", "=", "config", "[", "'environment_type'", "]", "not_al...
Sets the contract deployment data depending on the network id and environment type If an invalid combination of network id and environment type is provided, exits the program with an error
[ "Sets", "the", "contract", "deployment", "data", "depending", "on", "the", "network", "id", "and", "environment", "type" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/ui/startup.py#L94-L135
221,784
raiden-network/raiden
raiden/transfer/architecture.py
StateManager.dispatch
def dispatch(self, state_change: StateChange) -> List[Event]: """ Apply the `state_change` in the current machine and return the resulting events. Args: state_change: An object representation of a state change. Return: A list of events produced by th...
python
def dispatch(self, state_change: StateChange) -> List[Event]: """ Apply the `state_change` in the current machine and return the resulting events. Args: state_change: An object representation of a state change. Return: A list of events produced by th...
[ "def", "dispatch", "(", "self", ",", "state_change", ":", "StateChange", ")", "->", "List", "[", "Event", "]", ":", "assert", "isinstance", "(", "state_change", ",", "StateChange", ")", "# the state objects must be treated as immutable, so make a copy of the", "# curren...
Apply the `state_change` in the current machine and return the resulting events. Args: state_change: An object representation of a state change. Return: A list of events produced by the state transition. It's the upper layer's responsibility to d...
[ "Apply", "the", "state_change", "in", "the", "current", "machine", "and", "return", "the", "resulting", "events", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/architecture.py#L275-L308
221,785
raiden-network/raiden
raiden/waiting.py
wait_for_newchannel
def wait_for_newchannel( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, retry_timeout: float, ) -> None: """Wait until the channel with partner_address is registered. Note: This does not time ...
python
def wait_for_newchannel( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, retry_timeout: float, ) -> None: """Wait until the channel with partner_address is registered. Note: This does not time ...
[ "def", "wait_for_newchannel", "(", "raiden", ":", "'RaidenService'", ",", "payment_network_id", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "partner_address", ":", "Address", ",", "retry_timeout", ":", "float", ",", ")", "->", "None", ...
Wait until the channel with partner_address is registered. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "the", "channel", "with", "partner_address", "is", "registered", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L41-L67
221,786
raiden-network/raiden
raiden/waiting.py
wait_for_participant_newbalance
def wait_for_participant_newbalance( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, target_address: Address, target_balance: TokenAmount, retry_timeout: float, ) -> None: """Wait until a gi...
python
def wait_for_participant_newbalance( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, target_address: Address, target_balance: TokenAmount, retry_timeout: float, ) -> None: """Wait until a gi...
[ "def", "wait_for_participant_newbalance", "(", "raiden", ":", "'RaidenService'", ",", "payment_network_id", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "partner_address", ":", "Address", ",", "target_address", ":", "Address", ",", "target_ba...
Wait until a given channels balance exceeds the target balance. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "a", "given", "channels", "balance", "exceeds", "the", "target", "balance", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L70-L105
221,787
raiden-network/raiden
raiden/waiting.py
wait_for_payment_balance
def wait_for_payment_balance( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, target_address: Address, target_balance: TokenAmount, retry_timeout: float, ) -> None: """Wait until a given cha...
python
def wait_for_payment_balance( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, partner_address: Address, target_address: Address, target_balance: TokenAmount, retry_timeout: float, ) -> None: """Wait until a given cha...
[ "def", "wait_for_payment_balance", "(", "raiden", ":", "'RaidenService'", ",", "payment_network_id", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "partner_address", ":", "Address", ",", "target_address", ":", "Address", ",", "target_balance",...
Wait until a given channel's balance exceeds the target balance. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "a", "given", "channel", "s", "balance", "exceeds", "the", "target", "balance", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L108-L150
221,788
raiden-network/raiden
raiden/waiting.py
wait_for_channel_in_states
def wait_for_channel_in_states( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, channel_ids: List[ChannelID], retry_timeout: float, target_states: Sequence[str], ) -> None: """Wait until all channels are in `target_states`. ...
python
def wait_for_channel_in_states( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, channel_ids: List[ChannelID], retry_timeout: float, target_states: Sequence[str], ) -> None: """Wait until all channels are in `target_states`. ...
[ "def", "wait_for_channel_in_states", "(", "raiden", ":", "'RaidenService'", ",", "payment_network_id", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "channel_ids", ":", "List", "[", "ChannelID", "]", ",", "retry_timeout", ":", "float", ","...
Wait until all channels are in `target_states`. Raises: ValueError: If the token_address is not registered in the payment_network. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "all", "channels", "are", "in", "target_states", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L153-L210
221,789
raiden-network/raiden
raiden/waiting.py
wait_for_close
def wait_for_close( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, channel_ids: List[ChannelID], retry_timeout: float, ) -> None: """Wait until all channels are closed. Note: This does not time out, use gevent.Timeout....
python
def wait_for_close( raiden: 'RaidenService', payment_network_id: PaymentNetworkID, token_address: TokenAddress, channel_ids: List[ChannelID], retry_timeout: float, ) -> None: """Wait until all channels are closed. Note: This does not time out, use gevent.Timeout....
[ "def", "wait_for_close", "(", "raiden", ":", "'RaidenService'", ",", "payment_network_id", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", "channel_ids", ":", "List", "[", "ChannelID", "]", ",", "retry_timeout", ":", "float", ",", ")", "...
Wait until all channels are closed. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "all", "channels", "are", "closed", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L213-L232
221,790
raiden-network/raiden
raiden/waiting.py
wait_for_healthy
def wait_for_healthy( raiden: 'RaidenService', node_address: Address, retry_timeout: float, ) -> None: """Wait until `node_address` becomes healthy. Note: This does not time out, use gevent.Timeout. """ network_statuses = views.get_networkstatuses( views.state_fr...
python
def wait_for_healthy( raiden: 'RaidenService', node_address: Address, retry_timeout: float, ) -> None: """Wait until `node_address` becomes healthy. Note: This does not time out, use gevent.Timeout. """ network_statuses = views.get_networkstatuses( views.state_fr...
[ "def", "wait_for_healthy", "(", "raiden", ":", "'RaidenService'", ",", "node_address", ":", "Address", ",", "retry_timeout", ":", "float", ",", ")", "->", "None", ":", "network_statuses", "=", "views", ".", "get_networkstatuses", "(", "views", ".", "state_from_r...
Wait until `node_address` becomes healthy. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "node_address", "becomes", "healthy", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L306-L324
221,791
raiden-network/raiden
raiden/waiting.py
wait_for_transfer_success
def wait_for_transfer_success( raiden: 'RaidenService', payment_identifier: PaymentID, amount: PaymentAmount, retry_timeout: float, ) -> None: """Wait until a transfer with a specific identifier and amount is seen in the WAL. Note: This does not time out, use gevent....
python
def wait_for_transfer_success( raiden: 'RaidenService', payment_identifier: PaymentID, amount: PaymentAmount, retry_timeout: float, ) -> None: """Wait until a transfer with a specific identifier and amount is seen in the WAL. Note: This does not time out, use gevent....
[ "def", "wait_for_transfer_success", "(", "raiden", ":", "'RaidenService'", ",", "payment_identifier", ":", "PaymentID", ",", "amount", ":", "PaymentAmount", ",", "retry_timeout", ":", "float", ",", ")", "->", "None", ":", "found", "=", "False", "while", "not", ...
Wait until a transfer with a specific identifier and amount is seen in the WAL. Note: This does not time out, use gevent.Timeout.
[ "Wait", "until", "a", "transfer", "with", "a", "specific", "identifier", "and", "amount", "is", "seen", "in", "the", "WAL", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/waiting.py#L327-L351
221,792
raiden-network/raiden
raiden/utils/echo_node.py
EchoNode.poll_all_received_events
def poll_all_received_events(self): """ This will be triggered once for each `echo_node_alarm_callback`. It polls all channels for `EventPaymentReceivedSuccess` events, adds all new events to the `self.received_transfers` queue and respawns `self.echo_node_worker`, if it died. """ ...
python
def poll_all_received_events(self): """ This will be triggered once for each `echo_node_alarm_callback`. It polls all channels for `EventPaymentReceivedSuccess` events, adds all new events to the `self.received_transfers` queue and respawns `self.echo_node_worker`, if it died. """ ...
[ "def", "poll_all_received_events", "(", "self", ")", ":", "locked", "=", "False", "try", ":", "with", "Timeout", "(", "10", ")", ":", "locked", "=", "self", ".", "lock", ".", "acquire", "(", "blocking", "=", "False", ")", "if", "not", "locked", ":", ...
This will be triggered once for each `echo_node_alarm_callback`. It polls all channels for `EventPaymentReceivedSuccess` events, adds all new events to the `self.received_transfers` queue and respawns `self.echo_node_worker`, if it died.
[ "This", "will", "be", "triggered", "once", "for", "each", "echo_node_alarm_callback", ".", "It", "polls", "all", "channels", "for", "EventPaymentReceivedSuccess", "events", "adds", "all", "new", "events", "to", "the", "self", ".", "received_transfers", "queue", "a...
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/echo_node.py#L87-L132
221,793
raiden-network/raiden
raiden/utils/echo_node.py
EchoNode.echo_worker
def echo_worker(self): """ The `echo_worker` works through the `self.received_transfers` queue and spawns `self.on_transfer` greenlets for all not-yet-seen transfers. """ log.debug('echo worker', qsize=self.received_transfers.qsize()) while self.stop_signal is None: if self.r...
python
def echo_worker(self): """ The `echo_worker` works through the `self.received_transfers` queue and spawns `self.on_transfer` greenlets for all not-yet-seen transfers. """ log.debug('echo worker', qsize=self.received_transfers.qsize()) while self.stop_signal is None: if self.r...
[ "def", "echo_worker", "(", "self", ")", ":", "log", ".", "debug", "(", "'echo worker'", ",", "qsize", "=", "self", ".", "received_transfers", ".", "qsize", "(", ")", ")", "while", "self", ".", "stop_signal", "is", "None", ":", "if", "self", ".", "recei...
The `echo_worker` works through the `self.received_transfers` queue and spawns `self.on_transfer` greenlets for all not-yet-seen transfers.
[ "The", "echo_worker", "works", "through", "the", "self", ".", "received_transfers", "queue", "and", "spawns", "self", ".", "on_transfer", "greenlets", "for", "all", "not", "-", "yet", "-", "seen", "transfers", "." ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/echo_node.py#L134-L152
221,794
raiden-network/raiden
raiden/utils/runnable.py
Runnable.start
def start(self): """ Synchronously start task Reimplements in children an call super().start() at end to start _run() Start-time exceptions may be raised """ if self.greenlet: raise RuntimeError(f'Greenlet {self.greenlet!r} already started') pristine = ( ...
python
def start(self): """ Synchronously start task Reimplements in children an call super().start() at end to start _run() Start-time exceptions may be raised """ if self.greenlet: raise RuntimeError(f'Greenlet {self.greenlet!r} already started') pristine = ( ...
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "greenlet", ":", "raise", "RuntimeError", "(", "f'Greenlet {self.greenlet!r} already started'", ")", "pristine", "=", "(", "not", "self", ".", "greenlet", ".", "dead", "and", "tuple", "(", "self", "."...
Synchronously start task Reimplements in children an call super().start() at end to start _run() Start-time exceptions may be raised
[ "Synchronously", "start", "task" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/runnable.py#L26-L42
221,795
raiden-network/raiden
raiden/utils/runnable.py
Runnable.on_error
def on_error(self, subtask: Greenlet): """ Default callback for substasks link_exception Default callback re-raises the exception inside _run() """ log.error( 'Runnable subtask died!', this=self, running=bool(self), subtask=subtask, ex...
python
def on_error(self, subtask: Greenlet): """ Default callback for substasks link_exception Default callback re-raises the exception inside _run() """ log.error( 'Runnable subtask died!', this=self, running=bool(self), subtask=subtask, ex...
[ "def", "on_error", "(", "self", ",", "subtask", ":", "Greenlet", ")", ":", "log", ".", "error", "(", "'Runnable subtask died!'", ",", "this", "=", "self", ",", "running", "=", "bool", "(", "self", ")", ",", "subtask", "=", "subtask", ",", "exc", "=", ...
Default callback for substasks link_exception Default callback re-raises the exception inside _run()
[ "Default", "callback", "for", "substasks", "link_exception" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/utils/runnable.py#L59-L72
221,796
raiden-network/raiden
raiden/network/transport/matrix/utils.py
join_global_room
def join_global_room(client: GMatrixClient, name: str, servers: Sequence[str] = ()) -> Room: """Join or create a global public room with given name First, try to join room on own server (client-configured one) If can't, try to join on each one of servers, and if able, alias it in our server If still ca...
python
def join_global_room(client: GMatrixClient, name: str, servers: Sequence[str] = ()) -> Room: """Join or create a global public room with given name First, try to join room on own server (client-configured one) If can't, try to join on each one of servers, and if able, alias it in our server If still ca...
[ "def", "join_global_room", "(", "client", ":", "GMatrixClient", ",", "name", ":", "str", ",", "servers", ":", "Sequence", "[", "str", "]", "=", "(", ")", ")", "->", "Room", ":", "our_server_name", "=", "urlparse", "(", "client", ".", "api", ".", "base_...
Join or create a global public room with given name First, try to join room on own server (client-configured one) If can't, try to join on each one of servers, and if able, alias it in our server If still can't, create a public room with name in our server Params: client: matrix-python-sdk cli...
[ "Join", "or", "create", "a", "global", "public", "room", "with", "given", "name" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L254-L319
221,797
raiden-network/raiden
raiden/network/transport/matrix/utils.py
login_or_register
def login_or_register( client: GMatrixClient, signer: Signer, prev_user_id: str = None, prev_access_token: str = None, ) -> User: """Login to a Raiden matrix server with password and displayname proof-of-keys - Username is in the format: 0x<eth_address>(.<suffix>)?, where the su...
python
def login_or_register( client: GMatrixClient, signer: Signer, prev_user_id: str = None, prev_access_token: str = None, ) -> User: """Login to a Raiden matrix server with password and displayname proof-of-keys - Username is in the format: 0x<eth_address>(.<suffix>)?, where the su...
[ "def", "login_or_register", "(", "client", ":", "GMatrixClient", ",", "signer", ":", "Signer", ",", "prev_user_id", ":", "str", "=", "None", ",", "prev_access_token", ":", "str", "=", "None", ",", ")", "->", "User", ":", "server_url", "=", "client", ".", ...
Login to a Raiden matrix server with password and displayname proof-of-keys - Username is in the format: 0x<eth_address>(.<suffix>)?, where the suffix is not required, but a deterministic (per-account) random 8-hex string to prevent DoS by other users registering our address - Password is the signature...
[ "Login", "to", "a", "Raiden", "matrix", "server", "with", "password", "and", "displayname", "proof", "-", "of", "-", "keys" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L322-L434
221,798
raiden-network/raiden
raiden/network/transport/matrix/utils.py
validate_userid_signature
def validate_userid_signature(user: User) -> Optional[Address]: """ Validate a userId format and signature on displayName, and return its address""" # display_name should be an address in the USERID_RE format match = USERID_RE.match(user.user_id) if not match: return None encoded_address = ...
python
def validate_userid_signature(user: User) -> Optional[Address]: """ Validate a userId format and signature on displayName, and return its address""" # display_name should be an address in the USERID_RE format match = USERID_RE.match(user.user_id) if not match: return None encoded_address = ...
[ "def", "validate_userid_signature", "(", "user", ":", "User", ")", "->", "Optional", "[", "Address", "]", ":", "# display_name should be an address in the USERID_RE format", "match", "=", "USERID_RE", ".", "match", "(", "user", ".", "user_id", ")", "if", "not", "m...
Validate a userId format and signature on displayName, and return its address
[ "Validate", "a", "userId", "format", "and", "signature", "on", "displayName", "and", "return", "its", "address" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L438-L464
221,799
raiden-network/raiden
raiden/network/transport/matrix/utils.py
sort_servers_closest
def sort_servers_closest(servers: Sequence[str]) -> Sequence[Tuple[str, float]]: """Sorts a list of servers by http round-trip time Params: servers: sequence of http server urls Returns: sequence of pairs of url,rtt in seconds, sorted by rtt, excluding failed servers (possibly empty...
python
def sort_servers_closest(servers: Sequence[str]) -> Sequence[Tuple[str, float]]: """Sorts a list of servers by http round-trip time Params: servers: sequence of http server urls Returns: sequence of pairs of url,rtt in seconds, sorted by rtt, excluding failed servers (possibly empty...
[ "def", "sort_servers_closest", "(", "servers", ":", "Sequence", "[", "str", "]", ")", "->", "Sequence", "[", "Tuple", "[", "str", ",", "float", "]", "]", ":", "if", "not", "{", "urlparse", "(", "url", ")", ".", "scheme", "for", "url", "in", "servers"...
Sorts a list of servers by http round-trip time Params: servers: sequence of http server urls Returns: sequence of pairs of url,rtt in seconds, sorted by rtt, excluding failed servers (possibly empty)
[ "Sorts", "a", "list", "of", "servers", "by", "http", "round", "-", "trip", "time" ]
407ba15c72074e9de88771d6b9661ff4dc36bef5
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/utils.py#L467-L491