1
0
Commit Graph

18874 Commits

Author SHA1 Message Date
ThomasV
15e77d2d80 Merge pull request #9929 from f321x/swapserver_icon
qt: show deterministic colors for swapservers
2025-06-10 09:57:36 +02:00
ThomasV
e6ba90f219 Merge pull request #9928 from f321x/swap_fee_slider
swaps: use eta:2 instead of config fee policy in qml, disable qt fee slider on reverse swaps
2025-06-10 09:51:00 +02:00
f321x
6af54866c9 qt: show deterministic colors for swapservers
shows a little color icon which generated deterministically from
the server pubkey for easier differentiation.
2025-06-10 09:49:03 +02:00
SomberNight
c2e8188568 tests: test_network: add more header chain resolution test cases 2025-06-09 20:31:05 +00:00
SomberNight
eb69b6b516 interface: _search_headers_backwards: start at small delta
- interface.tip is the server's tip.
- consider scenario:
  - client has chain len 800_000, is up to date
  - client goes offline
  - suddenly there is a short reorg
      e.g. blocks 799_998, 799_999, 800_000 are reorged
  - client was offline for long time, finally comes back online again
  - server tip is 1_000_000, tip_header does not connect to client's local chain
  - PREVIOUSLY before commit, client would start backwards search
    - first it asks for header 800_001, which does not connect
    - then client asks for header ~600k, which checks
    - client will do long binary search to find the forkpoint
  - AFTER commit, client starts backwards search
    - first it asks for header 800_001, which does not connect
    - then client asks for header 799_999, etc
- that is, previously, on average, client did a short backwards search, followed by a long binary search
- now, on average, client does a longer backwards search, followed by a shorter binary search
  - this works much nicer with the headers_cache
  (- and thomasv said the old behaviour was not intentional)
2025-06-09 19:34:37 +00:00
SomberNight
02c6e118f0 tests: test_network: intro MockBlockchain. rewrite tests to use it.
interface.py no longer has knowledge about mocking! :P
2025-06-09 19:34:34 +00:00
SomberNight
cb1789a59c tests: test_network: try to explain test cases
no functional changes
2025-06-09 17:57:36 +00:00
SomberNight
09e412baf8 tests: enable verbose stderr logging
note: print() statements and stderr logging don't have a consistent printing order.
Either can buffer log lines and flush them later, and the buffers are independent.
2025-06-09 17:40:27 +00:00
SomberNight
ffb12b2833 tests: test_network: shorten lines 2025-06-09 17:22:49 +00:00
ThomasV
2b8a0d5a1d Merge pull request #9927 from SomberNight/202506_gui_swapserver_pubkey
gui: "Choose Swap Provider" screen: show hex pubkey, and longer prefix
2025-06-09 17:53:20 +02:00
SomberNight
9016c36df0 tests: test_network.py: rm test_fork_conflict, no longer applicable
Just prior to this commit, test_fork_conflict and test_fork_noconflict were essentially identical copies.
The only diff was that test_fork_conflict set the global blockchain.blockchains,
but this was not even affecting its behaviour anymore.

Originally when this test was added, we had the concept of chain fork conflicting with each other:
we could not handle three-way chain-splits. As in, there could only be a single fork forking away
from the main chain at any given height.
see 7221fb3231

However, this restriction was removed and generalised later:
141ff99580
After which the "test_fork_conflict" test did not make sense anymore.
2025-06-09 15:46:02 +00:00
ghost43
0d83e5690f Merge pull request #9926 from SomberNight/202506_iface_headers3
interface: faster chain resolution: add headers_cache
2025-06-09 15:37:41 +00:00
f321x
37181cd3a8 disable qt swap fee slider on reverse swaps, change eta
disables the fee slider in the swap dialog for reverse swaps as the tx
fee for claiming is not configurable by the user. Also replaces calls to
`sm.get_swap_tx_fee()` with `sm.get_fee_for_txbatcher()` as this is the
correct fee estimate for claim transactions, instead of the config fee
eta used by `get_swap_tx_fee()`.
2025-06-09 17:36:38 +02:00
SomberNight
dbb9673139 interface: faster chain resolution: add headers_cache
We try to predict the next headers the interface will ask for,
and request them ahead of time, to be kept in the headers_cache.

This saves network latency/round-trips, for a bit more memory usage
and in some cases for more bandwidth.
Note that due to PaddedRSTransport.WAIT_FOR_BUFFER_GROWTH_SECONDS,
latency saved here can be longer than "real" network latency.

This speeds up
- binary search greatly,
- backwards search to a small degree
  (although not that much as its algorithm should be changed a bit to make it cache-friendly)
- catch-up greatly, if it's <10 blocks behind

What remains is to speed up catch-up in case we are behind by many thousands of block.
That behaviour is left unchanged here. The issue there is that we request chunks sequentially.
So e.g. 1 chunk (2016 blocks) per 1 second.
2025-06-09 15:36:04 +00:00
f321x
4849d4d770 fix: use eta:2 as funding tx fee policy in qml swap
qml used the user config fee policy for the forward swap onchain funding
tx which can be too high or low, depending on what transactions the user
did previously with the wallet. Setting it to eta:2 ensures that the
funding tx is paying a sane fee.
2025-06-09 17:15:09 +02:00
SomberNight
becb912397 gui: "Choose Swap Provider" screen: show hex pubkey, and longer prefix
- makes it consistent between the qml and qt guis that now both show the hex pubkey
  - previously qml was showing npub
- don't truncate to first 10 chars, as that's still easy to bruteforce
  - the qt gui has space to display the full pubkey (64 hex chars)
    and can use the TreeWidget's columns to truncate as needed
  - qml has less space, truncate to 32 hex chars there (128 bits should be enough against bruteforce)
2025-06-09 15:12:32 +00:00
SomberNight
af11ebb3c3 interface: _search_headers_backwards: add an assert 2025-06-09 13:12:35 +00:00
SomberNight
b01e69cf45 interface: split request_chunk method 2025-06-09 13:12:31 +00:00
SomberNight
57bb98dc7f blockchain: parameterise magic number 2016 as CHUNK_SIZE 2025-06-09 13:11:59 +00:00
SomberNight
27599ac537 interface: small clean-up. intro ChainResolutionMode.
- type hints
- minor API changes
- no functional changes
2025-06-06 16:42:15 +00:00
ghost43
2b5147eb4d Merge pull request #9921 from f321x/fix_plugin_aiohttp_client_session
fix: use make_aiohttp_session for plugin zip download
2025-06-06 16:20:56 +00:00
f321x
18e241edf0 fix: use make_aiohttp_session for plugin dl 2025-06-06 17:24:41 +02:00
ThomasV
d3921ca25b fix lnwatcher callback (follow-up 5610a94537) 2025-06-06 17:18:09 +02:00
SomberNight
bac716c925 build: bump electrum-ecc to 0.0.5 2025-06-06 15:04:03 +00:00
SomberNight
ff777946fe build: win/mac: rename pyinstaller spec files
for clarity
also, "deterministic.spec" is a confusing name
2025-06-06 15:00:20 +00:00
ghost43
0a89662952 Merge pull request #9919 from f321x/debug_ssl_error
bump aiohttp version to 3.12.9
2025-06-06 14:32:13 +00:00
f321x
f260cddaf3 bump aiohttp version to 3.12.9 2025-06-06 16:29:18 +02:00
ghost43
d1c5cafcdd Merge pull request #9898 from f321x/windows_disable_screenshot
qt: windows: protect against screenshots and screen recordings
2025-06-06 13:42:29 +00:00
accumulator
6b928c5032 Merge pull request #9916 from f321x/fix_flaky_swapserver_list_qml
fix: use single long lived swap transport in qeswaphelper
2025-06-06 14:50:09 +02:00
Sander van Grieken
89cab31b81 qml: swaphelper: update offer model properly 2025-06-06 14:38:24 +02:00
f321x
3a39abc415 fix: use single long lived transport in qeswaphelper
changes qeswaphelper to shate a single, long lived transport instance
instead of opening new transports to do swaps and fetch offers.
This allows to continuosly fetch offers, so events which get returned
later by slow relays don't get missed and the fee values stay updated.
Also fixes a race causing the list to miss some swapservers, as the
current implementation fetches only until
`swap_manager.is_initialized()` is set, which will get set as soon as an
event of the configured swapserver is received. So if the event of the
configured swapserver is received as first, all server events coming in
after it would get ignored.
2025-06-06 14:38:11 +02:00
Sander van Grieken
0a6f6ab006 qml: use color for accounting addresses 2025-06-06 13:38:48 +02:00
ThomasV
cd2f52e2d9 follow-up 5610a94537 2025-06-06 12:35:41 +02:00
ThomasV
5610a94537 fix #9856 2025-06-06 12:17:21 +02:00
ThomasV
ba0c58e5d9 Merge pull request #9917 from spesmilo/txbatcher_clean_local_tx
txbatcher: remove local base_tx
2025-06-06 10:46:16 +02:00
ThomasV
1bf1de36cb txbatcher:
- add base_tx to wallet before broadcasting
 - remove base_tx in find_base_tx, it is local
 - add unit test in test_tx_batcher
2025-06-06 10:16:32 +02:00
f321x
ca9c4777d8 windows: protect against screenshots and screen recordings 2025-06-06 09:29:01 +02:00
ThomasV
6711b65b8c Qt: use color for accounting addresses 2025-06-06 09:18:12 +02:00
ThomasV
a0636e8f33 lnworker: fix timestamp in get_lightning_history 2025-06-06 08:46:21 +02:00
SomberNight
7df8847aee Merge branch '202505_build1': build: upgrade deps
- rerun freeze_packages
- bump cpython
- bump libsecp
- bump libusb
- bump pyinstaller
- windows:
  - bump wine
- appimage:
  - bump debian base from 2019 to 2021
- android
  - update pinned versions in p4a recipes
- cleanups
2025-06-05 19:35:10 +00:00
SomberNight
c52a29fc22 build: appimage: fix trezor plugin for new trezorlib
- similar to prev commit that fixes it for the pyinstaller builds
- note that .dist-info/RECORD files are still not reproducible for many packages :((((

```
$ cd dist/
$ ./electrum-*-x86_64.AppImage1 --appimage-extract
$ mv squashfs-root/ squashfs-root1/
$ ./electrum-*-x86_64.AppImage2 --appimage-extract
$ mv squashfs-root/ squashfs-root2/
$ $(cd squashfs-root1; find -type f -exec sha256sum '{}' \; > ./../sha256sum1)
$ $(cd squashfs-root2; find -type f -exec sha256sum '{}' \; > ./../sha256sum2)
$ diff sha256sum1 sha256sum2 > d
$ cat d
507c507
< 269a133bd0d3c85265219c14154323ed934ac36ef9b389da609e43788de2bbcd  ./usr/lib/python3.12/site-packages/cffi-1.17.1.dist-info/RECORD
---
> d2c08987f207eed8e90476c576eeff67c0809d1bfd35234e583a2dc6895c5ff1  ./usr/lib/python3.12/site-packages/cffi-1.17.1.dist-info/RECORD
518c518
< d08bd76099191932f3cd289c19427ccab51d9c00a6c2e5126c57f83a84ec2246  ./usr/lib/python3.12/site-packages/aiohttp-3.12.4.dist-info/RECORD
---
> 281c5c7e2b28e56134fa8690a2a446e3ebc515f8cb3705cd5d06e83c53812fab  ./usr/lib/python3.12/site-packages/aiohttp-3.12.4.dist-info/RECORD
630c630
< 33665bc46c14e2c0f409ef2627170b093f6d7741e9516928928acbeeb717f155  ./usr/lib/python3.12/site-packages/propcache-0.3.1.dist-info/RECORD
---
> 4fddb29289418edb3ec392a09b8efa826333a60cf508055cac809375e497174e  ./usr/lib/python3.12/site-packages/propcache-0.3.1.dist-info/RECORD
1497c1497
< f80c1b47d15a7262ab2b81bcfc1f69816961b9f6b0fd3775ee5b5eb40d4b7a5b  ./usr/lib/python3.12/site-packages/pyqt6_sip-13.10.2.dist-info/RECORD
---
> 1b8fb8ea4d50d401cd4f6689531ab4922cb064b9caaec1aae6bd885c3a387eca  ./usr/lib/python3.12/site-packages/pyqt6_sip-13.10.2.dist-info/RECORD
3108c3108
< ca06bbe1dba05cd647e89411dd301fad15f42d0ff53ac2c509391cf0303c15c4  ./usr/lib/python3.12/site-packages/multidict-6.4.4.dist-info/RECORD
---
> 400741699b95d3c6bde3c64c7a4bb04b26cbdaee437a17b398d202794a1bd4cd  ./usr/lib/python3.12/site-packages/multidict-6.4.4.dist-info/RECORD
3233c3233
< f67e8f271725676df296fab7fab72099f3b853905f9ff677b5de261a52412411  ./usr/lib/python3.12/site-packages/hidapi-0.14.0.post4.dist-info/RECORD
---
> f4d43d5e4c3c2aa3e69fa40c7307b23b82ce4c5e4d5fb041a75b11ddc2ed7423  ./usr/lib/python3.12/site-packages/hidapi-0.14.0.post4.dist-info/RECORD
3271c3271
< aaa92bb84d0f56e82832903f1109dd4362c09ea4af0fefe3d0c95509bc0920ed  ./usr/lib/python3.12/site-packages/cbor2-5.6.5.dist-info/RECORD
---
> 8a21af0fadf22898266581df9987c97ee737a670bef9d71d5f53427619466b88  ./usr/lib/python3.12/site-packages/cbor2-5.6.5.dist-info/RECORD
```

-----

Example RECORD files:

```
$ diff squashfs-root1/./usr/lib/python3.12/site-packages/aiohttp-3.12.4.dist-info/RECORD squashfs-root2/./usr/lib/python3.12/site-packages/aiohttp-3.12.4.dist-info/RECORD
64c64
< aiohttp/_http_parser.cpython-312-x86_64-linux-gnu.so,sha256=SjcWt8faDDTOxBHetnDdlQU31sPj0Suc8pwY1_UnKkE,2868384
---
> aiohttp/_http_parser.cpython-312-x86_64-linux-gnu.so,sha256=xdf5Uy_NnFLmSmqNmeY7wytgwFdY7pHxZLOFFfl2Aq8,2868384
66c66
< aiohttp/_http_writer.cpython-312-x86_64-linux-gnu.so,sha256=g6PDJVuICGYq8rywuI6XFWLP6tw1KLWLpwSvJODWo18,510280
---
> aiohttp/_http_writer.cpython-312-x86_64-linux-gnu.so,sha256=U_Y0F0oYClrGRIKO_agXtAohjJ_jqfG375vESBZ56CY,510280
80c80
< aiohttp/_websocket/mask.cpython-312-x86_64-linux-gnu.so,sha256=u0PluBaJntMBktyD1AYv267FvbUO6gpj-Nt7erLj3Qg,257384
---
> aiohttp/_websocket/mask.cpython-312-x86_64-linux-gnu.so,sha256=tEnvrEzSPEtaFI8V_Ey08zy4SBmDhnm-QnxTxgDSYM4,257384
85c85
< aiohttp/_websocket/reader_c.cpython-312-x86_64-linux-gnu.so,sha256=wfcclW8jYOTVeLDRPO87dPvOBrtXiqxBsnEbP0yyGpI,1816496
---
> aiohttp/_websocket/reader_c.cpython-312-x86_64-linux-gnu.so,sha256=jfey8U3MSIp04r0bG_a1TFkIKSzMQ-FLSAWD3nY4wgg,1816496
```

```
$ diff squashfs-root1/./usr/lib/python3.12/site-packages/hidapi-0.14.0.post4.dist-info/RECORD squashfs-root2/./usr/lib/python3.12/site-packages/hidapi-0.14.0.post4.dist-info/RECORD
1c1
< hid.cpython-312-x86_64-linux-gnu.so,sha256=JefmLwo-XKZZmno3PBdmHnREed0Yw7IaPYCI2k1UmbM,1152024
---
> hid.cpython-312-x86_64-linux-gnu.so,sha256=38htTAcIC4nnTPIIjD0jkdtdwtGyWlBIhQwQ-g0K0iI,1152024
12c12
< hidraw.cpython-312-x86_64-linux-gnu.so,sha256=dJ4kVI0jXUj_Ba2cMcAL7Wjy8fkO21VPbhAmR-5n30Y,1156768
---
> hidraw.cpython-312-x86_64-linux-gnu.so,sha256=7908Jgbg7A-3JRtfKabPr_WJkMIjYgd5pX78_Yajo54,1156768
```

-----

error at runtime:
```
 22.51 | E | plugins.trezor.trezor | error importing trezor plugin deps
Traceback (most recent call last):
  File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/importlib/metadata/__init__.py", line 397, in from_name
    return next(cls.discover(name=name))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/site-packages/electrum/plugins/trezor/trezor.py", line 29, in <module>
    from .clientbase import TrezorClientBase, RecoveryDeviceInputMethod
  File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/site-packages/electrum/plugins/trezor/clientbase.py", line 18, in <module>
    import trezorlib.device
  File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/site-packages/trezorlib/device.py", line 27, in <module>
    from slip10 import SLIP10
  File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/site-packages/slip10/__init__.py", line 6, in <module>
    __version__ = importlib.metadata.version(__package__ or __name__)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/importlib/metadata/__init__.py", line 889, in version
    return distribution(distribution_name).version
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/importlib/metadata/__init__.py", line 862, in distribution
    return Distribution.from_name(distribution_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.mount_electrteDkNu/usr/lib/python3.12/importlib/metadata/__init__.py", line 399, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for slip10

```
2025-06-05 18:46:12 +00:00
SomberNight
aecc22dc08 build: win/mac: fix trezor plugin for new trezorlib
trezor==0.13.10 pulls in new dep "slip10", which relies on importlib magic

see 19561f0429/slip10/__init__.py (L6)

```
 10.13 | E | plugins.trezor.trezor | error importing trezor plugin deps
Traceback (most recent call last):
  File "importlib/metadata/__init__.py", line 397, in from_name
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "electrum/plugins/trezor/trezor.py", line 29, in <module>
    from .clientbase import TrezorClientBase, RecoveryDeviceInputMethod
  File "PyInstaller/loader/pyimod02_importers.py", line 450, in exec_module
  File "electrum/plugins/trezor/clientbase.py", line 18, in <module>
    import trezorlib.device
  File "PyInstaller/loader/pyimod02_importers.py", line 450, in exec_module
  File "trezorlib/device.py", line 27, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 450, in exec_module
  File "slip10/__init__.py", line 6, in <module>
  File "importlib/metadata/__init__.py", line 889, in version
  File "importlib/metadata/__init__.py", line 862, in distribution
  File "importlib/metadata/__init__.py", line 399, in from_name
importlib.metadata.PackageNotFoundError: No package metadata was found for slip10
```
2025-06-05 17:59:31 +00:00
SomberNight
2543c85712 windows build: workaround no longer needed with modern pip
upstream now carries our fix

ref https://github.com/spesmilo/electrum/issues/7739
ref https://github.com/pypa/distlib/pull/165
2025-06-05 17:59:17 +00:00
ThomasV
420cd1e5ed make wallet stop and restart-able 2025-06-05 19:12:47 +02:00
SomberNight
d17c4beee9 appimage build: add comment we should update to new appimagetool toolchain 2025-06-05 16:52:06 +00:00
SomberNight
fa271e3958 build: bump python versions in binaries
note: 3.12 just transitioned to security-only status,
so can't bump win/mac binaries without switching to 3.13
(as we don't compile our own cpython for those)
2025-06-05 16:51:56 +00:00
SomberNight
0340097754 android build: downgrade cython 2025-06-05 16:51:53 +00:00
SomberNight
04a0d30176 android build: update pinned versions in p4a recipes
note: some files have two versions in them, e.g.:
```
assert CffiRecipe._version == "1.15.1"
class CffiRecipePinned(util.InheritedRecipeMixin, CffiRecipe):
    version = "1.17.1"
```
The assert is left there as I think it might be useful to get a failure if we rebase p4a
and the upstream recipe version changes. There might be substantial changes in the upstream
recipe that we need to adapt to. In the happy case, if we rebase p4a, we just have to manually
update these asserts to the new versions at that time.
2025-06-05 16:51:43 +00:00
SomberNight
70aeaccaf8 android build: rm "certifi" recipe
I don't think this was ever needed(?). certifi is pure python
and it already gets pulled in from the main requirements.txt
2025-06-05 16:51:39 +00:00
SomberNight
ff4c794349 macos build: downgrade Qt to 6.7
this way we can keep the min supported macos version at 11 for now
2025-06-05 16:51:35 +00:00