Fix IndexError: list index out of range in clnclient.py

Fixes 
```
  File "/usr/src/suez/clnclient.py", line 78, in refresh
    ][0].get("alias")
IndexError: list index out of range
```
This commit is contained in:
mb300sd 2021-07-27 01:53:26 -04:00 committed by GitHub
parent bbf366572a
commit f6bc2ca511
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,10 +71,10 @@ class ClnClient:
chan.local_base_fee, chan.local_fee_rate = fee_local
chan.remote_base_fee, chan.remote_fee_rate = fee_remote
chan.local_alias = self.local_alias
chan.remote_alias = self._run("listnodes", chan.remote_node_id)[
"nodes"
][0].get("alias")
if not chan.remote_alias:
listnode = self._run("listnodes", chan.remote_node_id)
if len(listnode["nodes"]) > 0:
chan.remote_alias = listnode["nodes"][0].get("alias")
else:
chan.remote_alias = chan.remote_node_id
chan.last_forward = 0
chan.local_fees = 0