1
0
Commit Graph

19342 Commits

Author SHA1 Message Date
ghost43
356f50beae Merge pull request #10280 from f321x/fix_network_tab_selection
qt: fix ServerWidget (Network Tab)
2025-10-27 17:58:33 +00:00
ghost43
d21fd59815 Merge pull request #10281 from f321x/dont_connect_to_other_networks
interface: check genesis hash on connection
2025-10-27 17:55:09 +00:00
f321x
f2aa4404ad qt: fix ServerWidget
The ServerWidget was not working properly, when switching from "Manual
Mode" to "Auto Connect" the change wouldn't get saved as it depended on
having a correct server string entered (which isn't neccessary for Auto
Connect).
Also makes the widget behave more sane by cleaning the server input if
Auto Connect is enabled and switching to Manual Mode if the user
manually selects a server.

Update the ServerWidget every time it is shown (on initialization and
also when the user opens it again or switches between network dialog
tabs).
This will clean it up if the user has entered some invalid server and
closes it, otherwise this server would stay in the input field until the
application is restarted.

The list of servers in the ServerWidget allows the user to right click
and 'Use as server' on the servers in the list, however internally it
was handled differently than what the user would expect when clicking on
'Use as server'. E.g. if the user selects a server in autoconnect mode
it would still stay in autoconnect mode so the server could switch again
to another server any time? Now it will also change the mode to manual
(or stay in single server mode if that was selected before), making it
clear that this server will stay selected.

If the user clicks on "Follow this branch" the connect mode will get changed to
autoconnect as internally we connect to a random interface on this
branch.
2025-10-27 18:46:36 +01:00
f321x
679b7fe122 interface: add warmup budget to PaddedRSTransport
Adds a 1024 (unpadded) byte budget to the PaddedRSTransport below which
messages are instantly flushed down the socket before the transport will
beginn waiting for the buffer to reach MIN_PACKET_SIZE (1024).
This allows to get the first couple of messages sent quickly when
starting the wallet to improve UX.
2025-10-27 18:31:37 +01:00
f321x
ff2bbf159e interface: check genesis hash on connection
Prevents the client from accidentally connecting to a server on a
different network.
I noticed its possible to connect to mainnet servers on a signet
instance causing the recent peers to get populated with mainnet peers
rendering the wallet instance barely usable. Doing this check should
prevent this and similar issues.
2025-10-27 16:57:28 +01:00
ghost43
4bce545c26 Merge pull request #10275 from SomberNight/202510_android_desc
fastlane: revert full_description to plain text
2025-10-21 16:57:02 +00:00
SomberNight
224c5fa6c0 fastlane: revert full_description to plain text
Rich text does not work reliably.
This reverts to the old formatting, but keeps some of the reordering/text changes.
follow-up https://github.com/spesmilo/electrum/pull/9492

I compared looking at the description in:
- google play store app
- google play store website [1]
- fdroid app
- fdroid website [2]

notes:
- Links work on playstore website and fdroid website, but not in the apps.
  In the apps, they are not even shown at all, they are just ignored.
- ul/li/b tags do not work on playstore website

[1] https://play.google.com/store/apps/details?id=org.electrum.electrum
[2] https://f-droid.org/en/packages/org.electrum.electrum/
2025-10-21 16:48:27 +00:00
ghost43
c4306f041a Merge pull request #10268 from dulanting/master
chore: fix comment for electrum/gui/qt/main_window.py
2025-10-21 14:54:58 +00:00
dulanting
08fd2de003 chore: fix comment for electrum/gui/qt/main_window.py
Signed-off-by: dulanting <dulanting@outlook.jp>
2025-10-13 16:26:50 +08:00
ghost43
b3ab732998 Merge pull request #10265 from SomberNight/202510_ci_py314
ci: add task to also run unit tests with new python 3.14
2025-10-09 19:06:37 +00:00
SomberNight
dbacb503a4 tests: fix DeprecationWarnings for py3.14: asyncio.iscoroutinefunction
same as https://github.com/spesmilo/electrum/pull/10197
2025-10-09 15:43:54 +00:00
ghost43
611f9b4485 Merge pull request #10264 from SomberNight/202510_tx_cleanup
transaction: (trivial) add some missing type hints, minimal clean-up
2025-10-09 15:34:58 +00:00
ghost43
89734b3bd4 Merge pull request #10242 from f321x/return_preimage_cli
cli: add command to export preimage, return preimage from check_hold_invoice
2025-10-09 15:31:04 +00:00
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