The gossip db is loaded early when the network is started to save
time when the gui is locked and a wallet not yet loaded. Side effects
of the LNWallet to start peering when a channel db is loaded is
circumvented.
Enables lightning by creating a node private key and storing it in
the wallet. The gossiper is not launched at start up, only if there
are existing channels.
exceptions below are raised when running python3 with "-X dev":
Traceback (most recent call last):
File "...\electrum\electrum\util.py", line 999, in run_with_except_hook
run_original(*args2, **kwargs2)
File "...\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "...\electrum\electrum\sql_db.py", line 55, in run_sql
future.set_result(result)
File "...\Python38\lib\asyncio\base_events.py", line 721, in call_soon
self._check_thread()
File "...\Python38\lib\asyncio\base_events.py", line 758, in _check_thread
raise RuntimeError(
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one
Traceback (most recent call last):
File "...\electrum\electrum\gui\qt\main_window.py", line 3009, in closeEvent
self.clean_up() #
File "...\electrum\electrum\gui\qt\main_window.py", line 3026, in clean_up
self.gui_object.close_window(self)
File "...\electrum\electrum\gui\qt\__init__.py", line 340, in close_window
self.daemon.stop_wallet(window.wallet.storage.path)
File "...\electrum\electrum\daemon.py", line 518, in stop_wallet
wallet.stop()
File "...\electrum\electrum\wallet.py", line 344, in stop
self.lnworker.stop()
File "...\electrum\electrum\lnworker.py", line 602, in stop
super().stop()
File "...\electrum\electrum\lnworker.py", line 273, in stop
self.listen_server.close()
File "...\Python38\lib\asyncio\base_events.py", line 337, in close
self._loop._stop_serving(sock)
File "...\Python38\lib\asyncio\proactor_events.py", line 849, in _stop_serving
future.cancel()
File "...\Python38\lib\asyncio\windows_events.py", line 80, in cancel
return super().cancel()
File "...\Python38\lib\asyncio\base_events.py", line 721, in call_soon
self._check_thread()
File "...\Python38\lib\asyncio\base_events.py", line 758, in _check_thread
raise RuntimeError(
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one
It is ugly that the 'channel' callback takes a wallet I guess,
but with channel backups in one wallet, and active channels in another,
it was causing problems... (when open simultaneously)
This is too complicated and ugly because it relies on side
effects. What we should do instead is collapse transactions
in children nodes of QTreeView (see #6237)
Before this, we were subscribing to our addresses in their bip32 order,
leaking this information to servers. While this leak seems mostly harmless,
it is trivial to fix.
- Use change addresses (instead of receive) for the static_remotekey to_remote outputs,
and reserve these to greatly reduce the chance of address-reuse
- Use change addresses (instead of receive) for LN channel sweep addresses.
Note that these atm are not getting reserved.
- also, disallow deleting last address from an imported wallet (fixes#3254, fixes#4833)
- also, set LNBackups.sweep_address lazily, as during fresh wallet creation
there are no addresses in the wallet at that point yet! see trace below.
Traceback (most recent call last):
[...]
File "...\electrum\electrum\tests\test_commands.py", line 112, in test_export_private_key_deterministic
wallet = restore_wallet_from_text('bitter grass shiver impose acquire brush forget axis eager alone wine silver',
File "...\electrum\electrum\wallet.py", line 2575, in restore_wallet_from_text
wallet = Wallet(db, storage, config=config)
File "...\electrum\electrum\wallet.py", line 2502, in __new__
wallet = WalletClass(db, storage, config=config)
File "...\electrum\electrum\wallet.py", line 2346, in __init__
Deterministic_Wallet.__init__(self, db, storage, config=config)
File "...\electrum\electrum\wallet.py", line 2147, in __init__
Abstract_Wallet.__init__(self, db, storage, config=config)
File "...\electrum\electrum\wallet.py", line 261, in __init__
self.lnbackups = LNBackups(self)
File "...\electrum\electrum\lnworker.py", line 1401, in __init__
self.sweep_address = wallet.get_receiving_address()
File "...\electrum\electrum\wallet.py", line 1498, in wrapper
addr = func(self, *args, **kwargs)
File "...\electrum\electrum\wallet.py", line 1520, in get_receiving_address
raise Exception("no receiving addresses in wallet?!")
Exception: no receiving addresses in wallet?!