1
0
Commit Graph

19299 Commits

Author SHA1 Message Date
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
ThomasV
c1ab6cda53 Merge pull request #10219 from SomberNight/202509_consoletaint
crash_reporter: flag reports where console was used in app_version
2025-09-13 11:25:32 +02:00
Peyton Allworth
67f09bf528 refactor(paymentrequest): use f-string in error message 2025-09-12 22:49:02 -07:00
SomberNight
e10cf30627 crash_reporter: flag reports where console was used in app_version
so we don't waste time on weird reports where the user modified
internals at runtime

ref
https://github.com/spesmilo/electrum/issues/10217
https://github.com/spesmilo/electrum/issues/10218
2025-09-11 17:01:52 +00:00
SomberNight
47f1a2d7a2 wallet.get_full_history: rm "include_fiat" arg, infer it from fx
ref https://github.com/spesmilo/electrum/pull/10209#discussion_r2334228490
2025-09-09 17:24:59 +00:00
ghost43
df45233c2f Merge pull request #10209 from f321x/fix_fiat_history_export
qt: add missing fiat values in csv/json history export
2025-09-09 16:56:21 +00:00
ghost43
b4a6de46f4 Merge pull request #10188 from f321x/capacity_warning_zero_amount
qt: receive dialog: also propose swaps for 0 amount invoices
2025-09-09 16:16:23 +00:00
ghost43
4389618f72 Merge pull request #10212 from SomberNight/202509_tests_for_old_hex_seed
tests: restore from old "hex" seed
2025-09-09 15:42:05 +00:00
ghost43
874d89b259 Merge pull request #10211 from f321x/swap_cleanup_check
swaps: only set swap redeemed if preimage is available
2025-09-09 15:40:29 +00:00
ThomasV
61aeffd26f qt: add_to_coincontrol: assert that coins are in self._utxo_dict 2025-09-09 15:55:54 +02:00
ThomasV
64a08f4937 fix #10206: replace for loop with single operation (dicts are threadsafe) 2025-09-09 12:55:37 +02:00
SomberNight
e97d8754c4 tests: restore from old "hex" seed 2025-09-08 17:12:24 +00:00
f321x
e1de1111f8 swaps: only set swap redeemed if preimage is available
For forward swaps this will ensure that the swap only gets set redeemed
and cleaned up after the preimage has been extracted, as it could happen
that `current_height - spent_height > REDEEM_AFTER_DOUBLE_SPENT_DELAY`
is true even if the preimage has not been extracted yet.

For reverse swaps this changes nothing as they always have the preimage.
2025-09-08 17:25:49 +02:00
ThomasV
dd7919b597 Merge pull request #10203 from SomberNight/202509_plugin_offline_cmd
commands: add clear error that plugin commands cannot be run with -o
2025-09-08 17:17:45 +02:00
SomberNight
b036eaf3eb lnwatcher: add some type hints 2025-09-08 15:01:50 +00:00
ThomasV
317bf998e3 Merge pull request #10204 from SomberNight/202509_wallet_rbf_candidates
qt confirm_tx_dialog: fix wallet.get_candidates_for_batching
2025-09-08 16:49:09 +02:00
ThomasV
ab9f4f734a Merge pull request #10210 from f321x/swap_cb
lnwatcher: catch callback exceptions
2025-09-08 14:58:19 +02:00
f321x
23f158291c lnwatcher: catch callback exceptions
Catch exceptions happening to callbacks to continue calling the
remaining callbacks. Otherwise if the first callback throws an exception
the remaining callbacks aren't going to be called.
2025-09-08 13:37:27 +02:00
ThomasV
2d17252b4b lnworker.has_anchor_channels: return False if channel is closed but not redeemed yet
this fixes the following issue: user cannot spend max until channel is redeemed.
see https://x.com/AnyoneOReally1/status/1964352775245951291
2025-09-08 10:39:41 +02:00
f321x
55d8974c8f fix: Re-add fiat values to csv history export
Re-add fiat values to the csv history export as they were missing due to
a regression.
2025-09-08 09:58:19 +02:00
f321x
c438f1dfe7 wallet history: also add fiat value to child tx
Makes `get_full_history` also add the fiat values to the children of a
tx, not only to the group itself.
2025-09-08 09:54:01 +02:00
ghost43
fdf8f9d980 Merge pull request #10205 from SomberNight/202509_storage_oschmod
storage.write: make os_chmod best-effort
2025-09-05 23:43:23 +00:00
SomberNight
9d13855c99 storage.write: make os_chmod best-effort
closes https://github.com/spesmilo/electrum/issues/8409
closes https://github.com/spesmilo/electrum/pull/8997
2025-09-05 19:51:33 +00:00
SomberNight
d01e6b8101 qt confirm_tx_dialog: fix wallet.get_candidates_for_batching
I don't understand what the "coins not used" comment meant here.
It was added in the change away from the old config.WALLET_BATCH_RBF option
(ab14c3e138).

The `coins` param *is used* in wallet.get_candidates_for_batching.
Without setting that, the returned set of candidates was restricted to
only base txs that had a large enough change output to cover *all* the newly added outputs.
Instead, it is desirable to allow adding new inputs.
2025-09-05 19:42:56 +00:00
ghost43
969deb2cd9 Merge pull request #10198 from f321x/add_swapserver_summary_cli
swapserver: add commands for stats and swap history
2025-09-05 18:38:34 +00:00