def __init__(self, chan: Channel, app: 'ElectrumWindow', **kwargs): Popup.__init__(self, **kwargs) Logger.__init__(self) self.is_closed = chan.is_closed() self.is_redeemed = chan.is_redeemed() self.app = app self.chan = chan self.title = _('Channel details') self.node_id = bh2u(chan.node_id) self.channel_id = bh2u(chan.channel_id) self.funding_txid = chan.funding_outpoint.txid self.short_id = format_short_channel_id(chan.short_channel_id) self.capacity = self.app.format_amount_and_units( chan.constraints.capacity) self.state = chan.get_state_for_GUI() self.local_ctn = chan.get_latest_ctn(LOCAL) self.remote_ctn = chan.get_latest_ctn(REMOTE) self.local_csv = chan.config[LOCAL].to_self_delay self.remote_csv = chan.config[REMOTE].to_self_delay self.initiator = 'Local' if chan.constraints.is_initiator else 'Remote' self.feerate = chan.get_latest_feerate(LOCAL) self.can_send = self.app.format_amount_and_units( chan.available_to_spend(LOCAL) // 1000) self.can_receive = self.app.format_amount_and_units( chan.available_to_spend(REMOTE) // 1000) self.is_open = chan.is_open() closed = chan.get_closing_height() if closed: self.closing_txid, closing_height, closing_timestamp = closed
def __init__(self, chan: Channel, app: 'ElectrumWindow', **kwargs): Popup.__init__(self, **kwargs) Logger.__init__(self) self.is_closed = chan.is_closed() self.is_redeemed = chan.is_redeemed() self.app = app self.chan = chan self.title = _('Channel details') self.node_id = bh2u(chan.node_id) self.channel_id = bh2u(chan.channel_id) self.funding_txid = chan.funding_outpoint.txid self.short_id = format_short_channel_id(chan.short_channel_id) self.capacity = self.app.format_amount_and_units(chan.get_capacity()) self.state = chan.get_state_for_GUI() self.local_ctn = chan.get_latest_ctn(LOCAL) self.remote_ctn = chan.get_latest_ctn(REMOTE) self.local_csv = chan.config[LOCAL].to_self_delay self.remote_csv = chan.config[REMOTE].to_self_delay self.initiator = 'Local' if chan.constraints.is_initiator else 'Remote' feerate_kw = chan.get_latest_feerate(LOCAL) self.feerate = str(quantize_feerate(Transaction.satperbyte_from_satperkw(feerate_kw))) self.can_send = self.app.format_amount_and_units(chan.available_to_spend(LOCAL) // 1000) self.can_receive = self.app.format_amount_and_units(chan.available_to_spend(REMOTE) // 1000) self.is_open = chan.is_open() closed = chan.get_closing_height() if closed: self.closing_txid, closing_height, closing_timestamp = closed msg = ' '.join([ _("Trampoline routing is enabled, but this channel is with a non-trampoline node."), _("This channel may still be used for receiving, but it is frozen for sending."), _("If you want to keep using this channel, you need to disable trampoline routing in your preferences."), ]) self.warning = '' if self.app.wallet.lnworker.channel_db or self.app.wallet.lnworker.is_trampoline_peer(chan.node_id) else _('Warning') + ': ' + msg