Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querying the API for channel list with a token address but not a partner address causes 500 error #3257

Closed
LefterisJP opened this issue Jan 11, 2019 · 0 comments
Assignees
Labels
Component / API Issues that relate the the APIs Raiden provides. Severity / Minor

Comments

@LefterisJP
Copy link
Contributor

Problem Definition

This was reported by a user in gitter. Logs and db can be fetched from there.

Important part is this stack trace:

1658 Unhandled exception when processing endpoint request	2019-01-11 08:46:27.018392	raiden.api.rest	critical	node=4a588a7f exception=Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 480, in wrapper resp = resource(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/flask/views.py", line 88, in view return self.dispatch_request(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 595, in dispatch_request resp = meth(*args, **kwargs) File "/home/htbc/raiden/raiden-network/raiden/raiden/api/v1/resources.py", line 64, in get **kwargs, File "/home/htbc/raiden/raiden-network/raiden/raiden/api/rest.py", line 762, in get_channel_list assert isinstance(raiden_service_result, list) AssertionError
1659 REST API stopped

coming right after a call to events of a token network without specifying a partner address:

1657 Getting channel list	2019-01-11 08:46:27.016541	raiden.api.rest	debug	node=4a588a7f registry_address=0x10bED41d09c98cf1aCCDcE570bc739428885E99d token_address=0x71efBfA6b5e20DbFBD84B2622D9175e120e0C9ea partner_address=None

The problem is rather simple. The assertion for the result being a list fails since in list_channelstate_for_tokennetwork():

def list_channelstate_for_tokennetwork(
chain_state: ChainState,
payment_network_id: PaymentNetworkID,
token_address: TokenAddress,
) -> List[NettingChannelState]:
token_network = get_token_network_by_token_address(
chain_state,
payment_network_id,
token_address,
)
if token_network:
result = token_network.channelidentifiers_to_channels.values()
else:
result = []
return result

token_network.channelidentifiers_to_channels.values() returns a dict_values type and not a list.

Task

Fix it. I got a PR with a test incoming.

@LefterisJP LefterisJP added Component / API Issues that relate the the APIs Raiden provides. Severity / Minor labels Jan 11, 2019
@LefterisJP LefterisJP added this to the Next Release milestone Jan 11, 2019
@LefterisJP LefterisJP self-assigned this Jan 11, 2019
@LefterisJP LefterisJP changed the title Querying the API for a token's events without a partner address causes 500 error Querying the API for channel list with a token address but not a partner address causes 500 error Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component / API Issues that relate the the APIs Raiden provides. Severity / Minor
Projects
None yet
Development

No branches or pull requests

1 participant