orb.misc.channels module

class orb.misc.channels.Channels(ln)

Bases: EventDispatcher, BalancedRatioMixin

This class should hold all the currently existing Channels, as orb.misc.channel.Channel objects.

The purpose is that it’s expensive getting channels over and over from LND. This class offers a way to read and effectively cache channel data.

In addition to caching, it also uses Kivi’s properties and event dispatcher mechanism so the application can observe channel attribute changes.

The object ids in self.channels should not change. Instead channels should be added and removed. This enables the rest of the application classes to bind data to these objects.

Please note this class is iterable.

property capacity
channels

the channels as a DictProperty

get()

Get and sorts channel data.

get_chan_policies(*_)
property global_ratio

Compute the global ratio, i.e local / capacity.

property local_balance
property local_balance_include_pending
property remote_balance
property remote_balance_include_pending
remove(channel)
sort_channels()

Sort channel data based on channel ratio.

sorted_chan_ids

the sorted channels chan_ids