|
|
|
@ -254,6 +254,10 @@ class LNWorker(Logger, NetworkRetryManager[LNPeerAddr]): |
|
|
|
self._add_peers_from_config() |
|
|
|
self._add_peers_from_config() |
|
|
|
asyncio.run_coroutine_threadsafe(self.main_loop(), self.network.asyncio_loop) |
|
|
|
asyncio.run_coroutine_threadsafe(self.main_loop(), self.network.asyncio_loop) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def stop(self): |
|
|
|
|
|
|
|
asyncio.run_coroutine_threadsafe(self.taskgroup.cancel_remaining(), self.network.asyncio_loop) |
|
|
|
|
|
|
|
util.unregister_callback(self.on_proxy_changed) |
|
|
|
|
|
|
|
|
|
|
|
def _add_peers_from_config(self): |
|
|
|
def _add_peers_from_config(self): |
|
|
|
peer_list = self.config.get('lightning_peers', []) |
|
|
|
peer_list = self.config.get('lightning_peers', []) |
|
|
|
for host, port, pubkey in peer_list: |
|
|
|
for host, port, pubkey in peer_list: |
|
|
|
@ -569,6 +573,11 @@ class LNWallet(LNWorker): |
|
|
|
tg_coro = self.taskgroup.spawn(coro) |
|
|
|
tg_coro = self.taskgroup.spawn(coro) |
|
|
|
asyncio.run_coroutine_threadsafe(tg_coro, self.network.asyncio_loop) |
|
|
|
asyncio.run_coroutine_threadsafe(tg_coro, self.network.asyncio_loop) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def stop(self): |
|
|
|
|
|
|
|
super().stop() |
|
|
|
|
|
|
|
self.lnwatcher.stop() |
|
|
|
|
|
|
|
self.lnwatcher = None |
|
|
|
|
|
|
|
|
|
|
|
def peer_closed(self, peer): |
|
|
|
def peer_closed(self, peer): |
|
|
|
for chan in self.channels_for_peer(peer.pubkey).values(): |
|
|
|
for chan in self.channels_for_peer(peer.pubkey).values(): |
|
|
|
chan.peer_state = PeerState.DISCONNECTED |
|
|
|
chan.peer_state = PeerState.DISCONNECTED |
|
|
|
@ -1404,6 +1413,10 @@ class LNBackups(Logger): |
|
|
|
for cb in self.channel_backups.values(): |
|
|
|
for cb in self.channel_backups.values(): |
|
|
|
self.lnwatcher.add_channel(cb.funding_outpoint.to_str(), cb.get_funding_address()) |
|
|
|
self.lnwatcher.add_channel(cb.funding_outpoint.to_str(), cb.get_funding_address()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def stop(self): |
|
|
|
|
|
|
|
self.lnwatcher.stop() |
|
|
|
|
|
|
|
self.lnwatcher = None |
|
|
|
|
|
|
|
|
|
|
|
def import_channel_backup(self, encrypted): |
|
|
|
def import_channel_backup(self, encrypted): |
|
|
|
xpub = self.wallet.get_fingerprint() |
|
|
|
xpub = self.wallet.get_fingerprint() |
|
|
|
decrypted = pw_decode_bytes(encrypted, xpub, version=PW_HASH_VERSION_LATEST) |
|
|
|
decrypted = pw_decode_bytes(encrypted, xpub, version=PW_HASH_VERSION_LATEST) |
|
|
|
|