Browse Source

lnchannel: log chan id in ChannelBackup logger

otherwise it's hard to debug what's going on when having many channels
master
SomberNight 3 years ago
parent
commit
52ccea5329
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 7
      electrum/lnchannel.py

7
electrum/lnchannel.py

@ -198,6 +198,9 @@ class AbstractChannel(Logger, ABC):
def short_id_for_GUI(self) -> str: def short_id_for_GUI(self) -> str:
return format_short_channel_id(self.short_channel_id) return format_short_channel_id(self.short_channel_id)
def diagnostic_name(self):
return self.get_id_for_log()
def set_state(self, state: ChannelState, *, force: bool = False) -> None: def set_state(self, state: ChannelState, *, force: bool = False) -> None:
"""Set on-chain state. """Set on-chain state.
`force` can be set while debugging from the console to allow illegal transitions. `force` can be set while debugging from the console to allow illegal transitions.
@ -440,7 +443,6 @@ class ChannelBackup(AbstractChannel):
def __init__(self, cb: ChannelBackupStorage, *, lnworker=None): def __init__(self, cb: ChannelBackupStorage, *, lnworker=None):
self.name = None self.name = None
Logger.__init__(self)
self.cb = cb self.cb = cb
self.is_imported = isinstance(self.cb, ImportedChannelBackupStorage) self.is_imported = isinstance(self.cb, ImportedChannelBackupStorage)
self._sweep_info = {} self._sweep_info = {}
@ -451,6 +453,7 @@ class ChannelBackup(AbstractChannel):
self.funding_outpoint = cb.funding_outpoint() self.funding_outpoint = cb.funding_outpoint()
self.lnworker = lnworker self.lnworker = lnworker
self.short_channel_id = None self.short_channel_id = None
Logger.__init__(self)
self.config = {} self.config = {}
if self.is_imported: if self.is_imported:
self.init_config(cb) self.init_config(cb)
@ -632,7 +635,7 @@ class Channel(AbstractChannel):
def diagnostic_name(self): def diagnostic_name(self):
if self.name: if self.name:
return str(self.name) return str(self.name)
return self.get_id_for_log() return super().diagnostic_name()
def set_onion_key(self, key: int, value: bytes): def set_onion_key(self, key: int, value: bytes):
self.onion_keys[key] = value self.onion_keys[key] = value

Loading…
Cancel
Save