1
0
Commit Graph

19529 Commits

Author SHA1 Message Date
SomberNight
2dc9ca906b ci: add task to also run unit tests with new python 3.14 2025-10-09 15:17:48 +00:00
SomberNight
6e45d6e690 lnworker: (trivial) add a few missing type-hints 2025-10-09 15:06:23 +00:00
SomberNight
3379e46249 follow-up prev: add type-hints, etc 2025-10-09 14:57:41 +00:00
SomberNight
f1ad5bc23d transaction: (move-only) move some methods from Tx to PartialTx cls
these were already assuming `isinstance(self, PartialTransaction)`
2025-10-09 14:46:42 +00:00
SomberNight
f832c33d76 qt: main_window.confirm_tx_dialog: rm dead code 2025-10-09 14:36:15 +00:00
SomberNight
58676219f4 wallet: (trivial) mark calc_unused_change_addresses as private 2025-10-07 17:45:38 +00:00
ThomasV
f4e7ffd5f3 lnworker: set OPTION_ONION_MESSAGE_OPT feature if we are forwarding. 2025-10-07 11:19:37 +02:00
SomberNight
95309e6730 Merge branch '202510_lnurlw': implement LNURL-withdraw
ref https://github.com/spesmilo/electrum/pull/9993
2025-10-03 02:21:31 +00:00
SomberNight
af6715040c lnurlw: follow-up: adapt to recent lnworker.get_bolt11_invoice refactor 2025-10-03 02:12:04 +00:00
SomberNight
ef8d53c46a lnurlw: follow-up: fix android edge-to-edge layout padding
as per https://github.com/spesmilo/electrum/pull/9993#issuecomment-3228252596
2025-10-03 02:11:43 +00:00
SomberNight
7d0ac64d06 Merge remote-tracking branch 'spesmilo/pr/9993': lnurl-withdraw
ref https://github.com/spesmilo/electrum/pull/9993
2025-10-02 23:34:40 +00:00
SomberNight
2b0cab68c6 partial merge 2: f321x's "lightning: refactor htlc switch"
split-off from https://github.com/spesmilo/electrum/pull/10230

Merge commit '286fc4b86e4d23cb9af15b9061b3d709e7592bcb'
2025-09-30 16:55:15 +00:00
f321x
b57f867c2f cli: add command to export preimage
..also export preimage in check_hold_invoice return value if available.

I intentionally did not return the preimage in the returned dict of
wallet.export_requests as this seems risky to do considering some users
of the cli might forward the response to a payer and the payserver
exposes it too.

Closes https://github.com/spesmilo/electrum/issues/10176
2025-09-30 10:37:20 +02:00
f321x
286fc4b86e lnworker: enforce creation of PaymentInfo for b11
Enforce that the information used to create a bolt11 invoice using
`get_bolt11_invoice()` is similar to the related instance of PaymentInfo
by requiring a PaymentInfo as argument for `get_bolt11_invoice()`.
This way the invoice cannot differ from the created PaymentInfo.
This allows to use the information in PaymentInfo for validation of
incoming htlcs more reliably.

To cover all required information for the creation of a b11 invoice the
PaymentInfo class has to be extended with a expiry and
min_final_cltv_expiry. This requires a db upgrade.
2025-09-30 09:54:35 +02:00
f321x
d62b627a0b lnpeer: move htlc forwarding funcs to lnworker
forwarding happens independent of the peer that received the htlc to
forward and fits better in lnworker.
2025-09-30 09:54:24 +02:00
SomberNight
3d27992fb7 lnonion: (trivial) make OnionPacket.__init__ kw-only 2025-09-29 17:13:27 +00:00
SomberNight
862f76bfef partial merge 1: f321x's "lightning: refactor htlc switch"
split-off from https://github.com/spesmilo/electrum/pull/10230
2025-09-29 17:12:25 +00:00
f321x
32aa6ab20c lnutil: rename RecvMPPResolution.ACCEPTED
Renames RecvMPPResolution.ACCEPTED to .COMPLETE as .ACCEPTED is somewhat
misleading. Accepted could imply that the preimage for this set has been
revealed or that the set has been settled, however it only means that we
have received the full set (it is complete), but the set still can be
failed (e.g. through cltv timeout) and has not been claimed yet.
2025-09-29 16:11:26 +00:00
f321x
6a4ad9e67c lnonion: check onion version in process_onion_packet
Adds checks for the onion version in process_onion_packet and fails it
back with the correct error instead of raising in the OnionPacket
constructor.
2025-09-29 16:11:23 +00:00
f321x
7d0a69a9ce lnpeer: only spawn htlc_switch for peers with LNWallet
stop spawning htlc_switch for LNGossip peers, they don't handle any
htlcs
2025-09-29 16:11:20 +00:00
f321x
fcc3796079 lnworker: move RecvMPPResolution and status to lnutil
it is required both in lnpeer and lnworker, moving it to lnutil seems to
make more sense.

# Conflicts:
#	electrum/lnworker.py
2025-09-29 16:11:17 +00:00
f321x
9db975f9d7 lightning: remove legacy payment secret derivation
This seems old and not very useful anymore.
2025-09-29 16:11:13 +00:00
f321x
0ae60d8b45 lnonion: make comparisons more constant time
makes hmac comparisons and onion error decoding more constant time
according to bolt 4. However things might still not be perfectly
constant time, however this seems out of scope for timing over network.
2025-09-29 16:11:10 +00:00
f321x
e6ea6dbf0a lnutil: make UpdateAddHtlc dataclass
it is straightforward to move UpdateAddHtlc away from attr
to a dataclass without requiring any db update.
2025-09-29 16:11:07 +00:00
f321x
4c0155c072 lnworker: make PaymentInfo dataclass
Move PaymentInfo from NamedTuple to dataclass to allow for easier
handling e.g. using dataclasses.astuple etc.
2025-09-29 16:11:03 +00:00
f321x
acd52da764 lnpeer: cleanup imports 2025-09-29 16:10:59 +00:00
ghost43
2ec6c3bd46 Merge pull request #10239 from SomberNight/202509_tests_clear_callbacks
tests: clear util.callback_mgr between test cases
2025-09-26 16:18:49 +00:00
SomberNight
5d1df96020 tests: clear util.callback_mgr between test cases
util.callback_mgr.callbacks was not getting properly cleared between tests.
Every time an Abstract_Wallet or an LNWorker (or many other subclasses of EventListener) is instantiated,
self.register_callbacks() is called in __init__, which puts callbacks into util.callback_mgr.callbacks.
These are only cleaned up if we explicitly call Abstract_Wallet.stop() or LNWorker.stop() later, which we usually do not do in the tests.

As a result, when running multiple unit tests in a row, lots of objects created in a given testcase are never GC-ed and leak into subsequent tests. This is not only a memory leak, but wastes compute too: when events are triggered and cbs get called, these old objects also have their cbs called.

After running all (~1061) unit tests, I observe util.callback_mgr.callbacks had 30 events with a total of 3156 callbacks stored.

On my laptop, running all unit tests previously took ~115 sec, and now it takes ~73 sec.
2025-09-26 15:53:41 +00:00
ghost43
fd0ad25775 Merge pull request #10238 from SomberNight/202509_ci_coveralls
ci: only run coveralls on one of the unittest tasks
2025-09-26 14:35:36 +00:00
ghost43
6877c6fe8b Merge pull request #10235 from SomberNight/202509_ci_appimage
ci: fix appimage build
2025-09-26 14:28:06 +00:00
SomberNight
750f1d0c99 ci: appimage build: run build.sh directly instead of sub-scripts
- previously we had the CI spawn us inside a docker container as per our Dockerfile,
  and we ran make_appimage.sh inside that
- now we also need to run make_type2_runtime.sh, which builds and runs another docker container, so the old approach does not work
  - follow-up https://github.com/spesmilo/electrum/pull/10019
- looks easier to just try to run build.sh, the outer script, which does all that
  - makes the CI task more similar to what dev machines run
  - at the cost of somewhat more compute
2025-09-26 14:25:24 +00:00
SomberNight
447c7cf8b3 build: Dockerfile: mod "new user to avoid using root" to support UID=0
Extend "create new user to avoid using root" copypasta to support being run as root
(ARG UID=0).

When running build.sh directly on a cirrus CI runner, we are running as root.
2025-09-26 14:24:26 +00:00
SomberNight
b676c1e9d3 build: docker run: make "-it" flags conditional on tty being available
from https://stackoverflow.com/a/69088164

I am trying to run the build.sh scripts directly on a cirrus CI runner, and "docker run -it" is erroring due to lack of a tty.
2025-09-26 14:24:23 +00:00
SomberNight
daaf7b7c6b appimage build: split out building type2-runtime into separate .sh 2025-09-26 14:24:19 +00:00
SomberNight
1423508341 ci: only run coveralls on one of the unittest tasks
coveralls has been quite flaky recently -- let's try to lower the number of CI tasks where it spreads the flakiness.
2025-09-26 13:24:53 +00:00
ghost43
14d7c96419 Merge pull request #10236 from SomberNight/202509_bash_subshell_set_e
contrib: "set -e" behaves weird in subshells followed by OR. don't use.
2025-09-25 14:49:53 +00:00
SomberNight
ffba6061bc contrib: "set -e" behaves weird in subshells followed by OR. don't use.
This exits as expected:
```
$ cat s1.sh
#!/bin/bash
set -e
(
    echo "a"
    false
    echo "b"
)

$ ./s1.sh
a
```
This does NOT exit, seemingly because of the outer context?!
```
$ cat s2.sh
#!/bin/bash
set -e
(
    echo "a"
    false
    echo "b"
) || echo "c"

$ ./s2.sh
a
b
```

ref https://unix.stackexchange.com/questions/65532/why-does-set-e-not-work-inside-subshells-with-parenthesis-followed-by-an-or
2025-09-25 14:04:14 +00:00
ghost43
de7612b3b1 Merge pull request #10216 from SomberNight/202509_adb_spv
adb: change API of util.TxMinedInfo: height() is now always SPV-ed
2025-09-24 13:50:14 +00:00
SomberNight
a4293c483e transaction: SPV-verify TxInput.block_height and .spent_height 2025-09-24 13:46:35 +00:00
SomberNight
b944371ffd adb: change API of util.TxMinedInfo: height() is now always SPV-ed 2025-09-24 13:46:24 +00:00
ghost43
8aedd8bf49 Merge pull request #10234 from SomberNight/202509_lnreserve_usechangeoff
wallet: anchor reserve: handle wallet.use_change being off
2025-09-24 13:40:02 +00:00
SomberNight
6a9c94ff0b wallet: anchor reserve: handle wallet.use_change being off
fixes https://github.com/spesmilo/electrum/issues/10231
2025-09-24 13:38:08 +00:00
ghost43
022d27ed03 Merge pull request #10019 from f321x/update_appimagetool
appimage: bump appimagetool to new version/repo
2025-09-23 16:16:55 +00:00
Sander van Grieken
0fcd8f76fc qml: small gridlayout fix in BalanceDetails 2025-09-19 15:36:07 +02:00
ThomasV
5c2c9ac941 network.py: do not require MyEncoder for serializing recent servers
This class is overkill. I am trying to restrict its usage to wallet_db
2025-09-18 12:04:17 +02:00
ThomasV
ff593ea118 Merge pull request #10226 from f321x/fix_8100
wallet: fix AttributeError when getting help text
2025-09-16 12:06:06 +02:00
f321x
b6a4ebecda wallet: fix AttributeError when getting help text
Fixes AttributeError when trying to get `num_sats_can_receive()` in
wallets without lnworker. Fixes https://github.com/spesmilo/electrum/issues/8100#issuecomment-3294556043.

```
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/electrum/gui/qt/request_list.py", line 103, in selection_changed
    self.receive_tab.update_current_request()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/electrum/gui/qt/receive_tab.py", line 237, in update_current_request
    help_texts = self.wallet.get_help_texts_for_receive_request(req)
  File "/usr/lib/python3.13/site-packages/electrum/wallet.py", line 3446, in get_help_texts_for_receive_request
    can_receive = self.lnworker.num_sats_can_receive()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'num_sats_can_receive'
```
2025-09-16 09:38:01 +02:00
ThomasV
12a8cdc842 Merge pull request #10223 from PeytonAllworth/refactor/fstring-upstream
refactor(paymentrequest): use f-string in error message
2025-09-14 11:28:51 +02:00
ThomasV
d36287e57d Merge pull request #10224 from copronista/patch-1
Update plugin.py
2025-09-14 10:32:49 +02:00
copronista
6be8e3ec88 Update plugin.py
https://github.com/spesmilo/electrum/issues/10220
2025-09-13 23:12:44 -04:00