Lightning addresses with 'lightning:' do occur in the wild and make
sense (how else would e.g. the smartphone know to open a lightning
wallet instead of the e-mail client). So we should allow this.
The done_callback for the callback tasks in _run_htlc_switch_iteration
tried to access mpp_sets by key but they might already have been deleted
when the callback is called, causing an KeyError. Instead forward the
exceptions to the crash reporter so we get notice of them and they get
logged correctly.
```
20251219T131356.946565Z | ERROR | asyncio | Exception in callback Peer._run_htlc_switch_iteration.<locals>.<lambda>(<Task finishe.../util.py:1773>) at /home/user/code/electrum-fork/electrum/lnpeer.py:2907
handle: <Handle Peer._run_htlc_switch_iteration.<locals>.<lambda>(<Task finishe.../util.py:1773>) at /home/user/code/electrum-fork/electrum/lnpeer.py:2907 created at /usr/lib64/python3.14/asyncio/events.py:94>
source_traceback: Object created at (most recent call last):
File "/usr/lib64/python3.14/threading.py", line 1082, in _bootstrap_inner
self._context.run(self.run)
File "/home/user/code/electrum-fork/electrum/util.py", line 1145, in run_with_except_hook
run_original(*args2, **kwargs2)
File "/usr/lib64/python3.14/threading.py", line 1024, in run
self._target(*self._args, **self._kwargs)
File "/home/user/code/electrum-fork/electrum/util.py", line 1705, in run_event_loop
loop.run_until_complete(stopping_fut)
File "/usr/lib64/python3.14/asyncio/base_events.py", line 706, in run_until_complete
self.run_forever()
File "/usr/lib64/python3.14/asyncio/base_events.py", line 677, in run_forever
self._run_once()
File "/usr/lib64/python3.14/asyncio/base_events.py", line 2038, in _run_once
handle._run()
File "/usr/lib64/python3.14/asyncio/events.py", line 94, in _run
self._context.run(self._callback, *self._args)
Traceback (most recent call last):
File "/usr/lib64/python3.14/asyncio/events.py", line 94, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/code/electrum-fork/electrum/lnpeer.py", line 2909, in <lambda>
f"{self.lnworker.received_mpp_htlcs[pk]=}", exc_info=t.exception()) if t.exception() else None
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
KeyError: '0000980000010001:1'
```
Some servers seem to serve their donation address with `bitcoin:`
prefix, preventing them from getting donations. This removes the prefix.
E.g.:
```
262.63 | I | interface.[2ex.digitaleveryware.com:50002] | invalid donation address from server: 'bitcoin:bc1q0q6lcajak7r8h8c8luzp0zj35v0usqd4pdzqjg'
```
Set SimpleConfig.CURRENT_WALLET = None if the wallet gets deleted,
otherwise we try to open it on the next startup which will show an error
message in QML.
QEWalletListModel.remove_wallet was calling beginRemoveRows with i
instead of remove as index, causing it to not delete the wallet from the
list and the wallet list becoming broken after deleting a wallet.
If the user has wallets with different passwords (non-unified pw) and
enters a password on startup that fails to unlock the recently used
wallet this change will automatically open any other wallet if there
is another wallet that can be unlocked with this password.
When closing the OpenWalletDialog without unlocking a wallet the
LoadingWalletDialog wouldn't get properly cleaned up as the
LoadingWalletDialog.visible was never set true. This causes the
connections to accumulate and the callbacks won't get unregistered after
closing the LoadingWalletDialog again.
Shows Wallets.qml as root if no wallet is loaded and removes the logic
for no loaded wallet from the WalletMainView as WalletMainView won't be
shown anymore without a Daemon.currentWallet.
In the GUI, when displaying the list of disconnected servers, we were
filtering to only ":s" servers. Instead now we also show ":t" servers
if they are bookmarked.
Also, if bookmarked, we also show disconnected .onion servers, even
when not using a Tor proxy.
fixes https://github.com/spesmilo/electrum/issues/10374
If a qml user with non-uniform wallet passwords tries to change their wallet
password this will force them to change it to a password that is used by
at least one other wallet. This will guide them towards a single wallet
password and prevents the number of different passwords from increasing.
If the user has not unlocked any wallet yet and tries to create a new
wallet in the overview a dialog will prompt them to first unlock an
existing wallet in order to be able to create a new wallet.
This ensures they remember at least one password so they can complete
the wizard. The wizard will ask them for an existing password later and
it would be annoying for the user to go through all steps (writing down
the seed etc.) only to find out they need a password they don't
remember. This way they can reinstall the app right before going through
the wizard.
This is an educated guess in fixing #10335, Qt can be very picky w.r.t. wrapping types,
and we have additional complexity in the PyQt/SIP layer.
as the address index is only used to facilitate sorting, convert address index tuple
to a sortable string instead.
This assumes uniformity in the length of address indexes.
When creating a new wallet in a Electrum instance with existing wallets
this change forces the user to reuse a password of any existing wallet
if `SimpleConfig.WALLET_USE_SINGLE_PASSWORD` is True.
This prevents the amount of different passwords from increasing and
guides the user towards a single wallet password (the intended default).
Only allow signing a transaction if it also gets broadcast by disabling
the signing and broadcast button of the preview dialog when creating a
new tx. Makes it slightly less trivial to cheat with the fees.
If RHASH is in lnworker.dont_settle_htlcs, we should not reveal
the preimage. But also, we should not disregard the htlc either.
E.g. during a JIT channel open, payment going A->B->C,
C would release the preimage to B (lsp) to cover the costs of the
JIT channel-open. If the upstream A->B channel gets force-closed, B should
only pull the HTLC's funds if he is sure he can forward them to C.
lnwatcher needs to keep watching (i.e. wait) until the RHASH gets removed from
lnworker.dont_settle_htlcs, or until the CLTV of the HTLC expires.
In some parts of the application 0 (sec) == no expiry, however we
use `LN_EXPIRY_NEVER` (100 years) instead of 0 for lightning invoices.
This replaces a 0 second expiry with `LN_EXPIRY_NEVER` in
`LNWallet.create_payment_info()` to prevent htlcs for no-expiry invoices
from getting failed incorrectly (which the assert prevented)
and fix the assertion error in #10350.
Fixes#10350.
# Conflicts:
# electrum/lnworker.py
Qt was showing the lightning_button percentage string while syncing gossip
as `...` instead of the percentage as the minimum width of the button
seemed too small. Increasing this a bit fixes the issue.
to work around https://github.com/kivy/python-for-android/issues/1866 :
> PyCryptodome >=3.6.0 crashes at runtime (since commit f5aa2c1618). So actually the currently pinned version in the recipe does not work:
> 80e4f059c1/pythonforandroid/recipes/pycryptodome/__init__.py (L5)
>
> The issue at runtime is with ctypes.
>
>
> Say I have a main script that just does the following (95ccce7ae8/lib/Crypto/Util/_raw_api.py (L200)):
> ```
> import ctypes
> ctypes.pythonapi.PyObject_GetBuffer
> ```
>
> This works with cpython on my laptop, but with the p4a-compiled python on Android it fails:
>
> ```
> 06-14 19:06:27.053 15246 15274 I python : Android kivy bootstrap done. __name__ is __main__
> 06-14 19:06:27.053 15246 15274 I python : AND: Ran string
> 06-14 19:06:27.053 15246 15274 I python : Run user program, change dir and execute entrypoint
> 06-14 19:06:27.092 15246 15274 I python : Traceback (most recent call last):
> 06-14 19:06:27.092 15246 15274 I python : File "/home/user/wspace/electrum/.buildozer/android/app/main.py", line 84, in <module>
> 06-14 19:06:27.093 15246 15274 I python : File "/home/user/wspace/electrum/.buildozer/android/platform/build/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/ctypes/__init__.py", line 369, in __getattr__
> 06-14 19:06:27.093 15246 15274 I python : File "/home/user/wspace/electrum/.buildozer/android/platform/build/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/ctypes/__init__.py", line 374, in __getitem__
> 06-14 19:06:27.094 15246 15274 I python : AttributeError: undefined symbol: PyObject_GetBuffer
> ```
>
> I have also tried to access some other attributes of `ctypes.pythonapi`, such as `Py_IncRef`, which raises the same exception.
---
Unclear if the issue still affects newer p4a: upstream seems to think it's fixed, but there multiple comments in the thread saying otherwise. Anyway, rebasing p4a has other blockers atm.
We had been using an ancient version of "cryptography" so far in our p4a fork,
however it is not compatible with OpenSSL 3.0. (Previously we were building it with OpenSSL 1.1)
Bumping "cryptography" is difficult, as building new versions of it from source requires a full rust toolchain.
Instead, this commit switches to "pycryptodomex", as a replacement, which is much easier to build from source.