Browse Source

pyln-testing: add get_channel_id helper

bump-pyln-proto
Michael Schmoock 4 years ago
committed by Rusty Russell
parent
commit
218a9efaec
  1. 9
      contrib/pyln-testing/pyln/testing/utils.py

9
contrib/pyln-testing/pyln/testing/utils.py

@ -800,6 +800,15 @@ class LightningNode(object):
channel = peers[0]['channels'][0] channel = peers[0]['channels'][0]
return channel['short_channel_id'] return channel['short_channel_id']
def get_channel_id(self, other):
"""Get the channel_id for the channel to the other node.
"""
peers = self.rpc.listpeers(other.info['id'])['peers']
if not peers or 'channels' not in peers[0]:
return None
channel = peers[0]['channels'][0]
return channel['channel_id']
def is_channel_active(self, chanid): def is_channel_active(self, chanid):
channels = self.rpc.listchannels(chanid)['channels'] channels = self.rpc.listchannels(chanid)['channels']
active = [(c['short_channel_id'], c['channel_flags']) for c in channels if c['active']] active = [(c['short_channel_id'], c['channel_flags']) for c in channels if c['active']]

Loading…
Cancel
Save