1
0
Commit Graph

16682 Commits

Author SHA1 Message Date
SomberNight
b45c84f24f remove the kivy gui
We now use the qml gui on Android, and haven't been maintaining
the kivy GUI for a while.
2023-08-30 16:47:37 +00:00
ghost43
e8c0767ca7 Merge pull request #8584 from SomberNight/202308_fix8582
invoices: also run amount-validator on setter
2023-08-30 16:27:00 +00:00
SomberNight
c3f16615ca android build: exclude kivy classes from qml apk
taken from https://github.com/spesmilo/electrum/pull/8545
22bfd4eca6

note: com.android.support is used in our p4a fork's PythonActivity.java
(com.android.support was previously pulled in by me.dm7.barcodescanner)
052b9f7945/pythonforandroid/bootstraps/qt5/build/src/main/java/org/kivy/android/PythonActivity.java (L43)
2023-08-30 14:10:56 +00:00
SomberNight
111a753dc2 ci: don't run unit tests on pypy
We never really supported pypy - the CI was running the tests there
just to see compatibility.
A few of the unit tests consistently hang, resulting in the whole
test runner timing out and wasting compute resources. Someone could
debug the hangs and try to fix them, but I don't have the time.
2023-08-30 12:46:12 +00:00
SomberNight
6557a21c45 channel_db: don't wait for load_data to finish if stopping
ChannelDB.load_data() takes ~15 seconds. Previously if the user tried
to close the program while load_data is running, we would block until
load_data() finished. (e.g. consider starting and immediately stopping
Electrum)
Now instead we can abort load_data early.
2023-08-30 11:49:42 +00:00
ThomasV
78f0f788d6 submarine swaps: use a short expiry with hold invoices, and display result to the user 2023-08-30 11:07:16 +02:00
ThomasV
4d0ec8d177 lnworker: choose IP address with recent timestamp (Rogach) 2023-08-30 09:32:34 +02:00
ThomasV
f5ab4b0f18 swapserver: sanity check amount in new flow 2023-08-27 20:56:49 +02:00
ThomasV
e06df2cb69 swapserver: reduce refund delay to 70 blocks
if a refund occurs, it needs to be done before the cltv expiration
of the htlc, or the channel might be force closed.
2023-08-27 14:06:56 +02:00
ThomasV
5e09a416a7 address_synchronizer: save stored_height on each block 2023-08-27 11:57:50 +02:00
ThomasV
40c08d350f trampoline: fix two bugs preventing legacy payments to
Electrum clients that have non-trampoline channels.

 - if an invoice supports trampoline, but provides only
non-trampoline nodes in its routing hints, we must use
a legacy trampoline payment

 - when we create a trampoline onion for a legacy payment,
the invoice_features field is a u64, so we need to remove
high feature bits.
2023-08-27 11:48:29 +02:00
ThomasV
b2053c68f1 make use_to_trampolines a user visible option, disable it by default 2023-08-27 11:43:17 +02:00
ThomasV
a300b8968a swapserver: do not expose the swapserver plugin in qt 2023-08-27 11:10:09 +02:00
ThomasV
341227c3cd qt: show routing hints in ln invoice window 2023-08-27 11:08:54 +02:00
SomberNight
b8d410849c fix revealer plugin for python 3.10+
fixes https://github.com/spesmilo/electrum/issues/7719
2023-08-25 23:35:07 +00:00
SomberNight
6a9e532ff1 Plugins: make Plugins.stop() faster
Plugins.stop() is now part of the normal shutdown flow (since 90f39bce88),
so this shaves up to 100 ms off that (avg: 50 ms).
It is also waited on in around ~60 unit tests: this saves 3 sec.
2023-08-24 18:27:34 +00:00
SomberNight
392f6d8e30 fix tests: another follow-up to daemon managing Plugins object
In python 3.8 and 3.9, asyncio.Event/Lock/etc cannot be created before the
event loop itself is created. Hence, to have Plugins.__init__ create an
Event, we need to postpone creating Plugins() from setUpClass to setUp.

follow-up 90f39bce88
2023-08-24 18:21:23 +00:00
SomberNight
1dfc1d567b follow-up prev 2023-08-24 17:30:06 +00:00
SomberNight
90f39bce88 run_electrum: have daemon manage Plugins object, and call Plugins.stop
Plugins.stop was never called, so the Plugins thread only stopped
because of the is_running() check in run(), which triggers too late:
the Plugins thread was stopping after the main thread stopped.

E.g. playing around in the qt wizard with wallet creation for a Trezor,
and closing the wizard (only window):
``` 24.85 | E | p/plugin.Plugins |
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/util.py", line 386, in run_jobs
    job.run()
  File "/home/user/wspace/electrum/electrum/plugin.py", line 430, in run
    client.timeout(cutoff)
  File "/home/user/wspace/electrum/electrum/plugin.py", line 363, in wrapper
    return run_in_hwd_thread(partial(func, *args, **kwargs))
  File "/home/user/wspace/electrum/electrum/plugin.py", line 355, in run_in_hwd_thread
    fut = _hwd_comms_executor.submit(func)
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 167, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
```
2023-08-24 17:15:14 +00:00
ThomasV
c12d9b14da qt console: add 'channels' shortcut 2023-08-24 12:09:59 +02:00
SomberNight
ffa3acc013 invoices: don't modify .amount_msat directly 2023-08-22 18:12:15 +00:00
SomberNight
4e6e6f76ca invoices: also run amount-validator on setter
- @amount_msat.validator prevents the creation of invoices with e.g. too large amounts
- however the qml gui is mutating invoices by directly setting the `amount_msat` field,
  and it looks like attrs validators only run during init.
  We can use `on_setattr` (introduced in attrs==20.1.0).
- a wallet db upgrade is added to rm existing insane invoices
- btw the qml gui was already doing its own input validation on the textedit
  (see qeconfig.btcAmountRegex). however that only limits the input to not have more
  chars than what is needed to represent 21M BTC (e.g. you can still enter 99M BTC,
  which the invoice logic does not tolerate later on - but is normally caught).

fixes https://github.com/spesmilo/electrum/issues/8582
2023-08-22 18:10:21 +00:00
SomberNight
7245762922 qt: fix lnurl-pay
regression from https://github.com/spesmilo/electrum/pull/8462
2023-08-22 17:00:17 +00:00
SomberNight
7482e275b9 follow-up storage/db changes
follow-up b96cc82333
2023-08-22 14:50:30 +00:00
SomberNight
e23c6c7050 release notes: add pre-notification of security fixes for 4.4.6 2023-08-22 11:11:53 +00:00
ThomasV
fc183e5143 Fix regtests (follow-up 0ebb6469ff)
Note: We should probably require the password in load_wallet,
and store it in memory as long as the wallet is loaded. In that
case, commands that currently require a password would no longer
require it if the wallet is loaded.
2023-08-18 08:52:02 +02:00
ThomasV
b96cc82333 Make storage a field of db
This comes from the jsonpatch_new branch.
I rather have in master now, because it touches a lot of filese.
2023-08-18 08:08:31 +02:00
ThomasV
0ebb6469ff CLI: make sure we do not load WalletDB while another process is accessing it
- do not load WalletDB in order to check keystore password
- do not allow --offline commands while a daemon is running
2023-08-18 08:05:54 +02:00
SomberNight
a3997f8b58 lnworker: don't create invoice with dupl t-hints, & filter when sending
- when creating an invoice, if we had multiple chans with the same trampoline,
  were putting duplicate t-hints into the invoice
- when paying an invoice that had duplicate t-hints, we would sometimes
  construct invalid paths (SRC>T1->T1->DST)
2023-08-17 20:04:02 +00:00
SomberNight
d684cf2dc3 update release notes for version 4.4.6 2023-08-17 16:32:16 +00:00
SomberNight
2e4fbd9275 update block header checkpoints 2023-08-17 15:45:43 +00:00
SomberNight
cee22abcb5 wallet_db: upgrade to version 53, for imported chan backups
follow-up https://github.com/spesmilo/electrum/pull/8536

This replaces 69336befee, which was insufficient.
#8536 added a new field into the struct, which older versions do not ignore but raise:
opening a wallet file with new code updated the struct to include it,
after which old code could no longer open the wallet file.
i.e. #8536 was an invisible wallet upgrade, breaking compat.
This commit simply formalises the wallet upgrade: old code will now show
an understandable error when trying to open new files.
2023-08-17 14:08:27 +00:00
SomberNight
635880b3cb qt gui: input_qr_from_screenshot: better msg if screenshot is black
The input_qr_from_screenshot functionality is broken on some Linux machines:
on some machines, `screen.grabWindow(0)` returns an all-black image.

In such cases, instead of telling the user "No QR code was found on the screen",
we will tell them "Failed to take screenshot".

To test:
`QApplication.instance().primaryScreen().grabWindow(0).save("/home/user/wspace/tmp/pic2.png", "png")`

Tested on:
- machine 1:
    - ubuntu 22.04, gnome, wayland
    - pyqt.version: 5.15.9
    - qt.version: 5.15.2
    => gets all-black image for screenshot
- machine 2:
    - manjaro, kde, x11
    - pyqt.version: 5.15.9
    - qt.version: 5.15.8
    => screenshot works

I guess it might be due to x11 vs wayland.
2023-08-16 17:38:42 +00:00
SomberNight
2c2e3f8ca4 util.randrange: expand docstring 2023-08-16 16:32:42 +00:00
SomberNight
5e1e7dd9b3 util.CallbackManager: make sure exceptions in cbs are logged
this resolves the existing FIXME
2023-08-16 16:27:17 +00:00
SomberNight
7012d998f1 json_db: add back profiler to _write
follow-up 411098f293
2023-08-15 17:04:49 +00:00
SomberNight
98ccad68c1 channel_db: add TTLs to channel_updates_for_private_channels
eclair sends CHANNEL_DISABLED if its peer is offline. E.g. we might be
trying to pay a mobile phone with the app closed. In that case we
should not cache the CHANNEL_DISABLED for too long.
2023-08-15 16:34:51 +00:00
SomberNight
1dd0608718 lnrouter: rework blacklist a bit
separate from LiquidityHintMgr
2023-08-15 16:34:48 +00:00
ThomasV
68be768818 swapserver: use taskgroup (follow-up 0083560ee6) 2023-08-15 09:15:57 +02:00
ThomasV
5f3a1f0b71 do not spam log with fee_histogram 2023-08-14 09:58:17 +02:00
ThomasV
0083560ee6 swapserver: throttle payments, handle exceptions in pay_pending_invoices 2023-08-14 09:53:04 +02:00
SomberNight
13864f7abe lnworker: clear paysessions dict 2023-08-11 22:01:22 +00:00
SomberNight
98bda60c01 lnworker: move sent_buckets into PaySession 2023-08-11 22:01:19 +00:00
SomberNight
00e88c4e50 lnworker: introduce PaySession cls, refactor pay_to_node 2023-08-11 22:01:16 +00:00
SomberNight
98bea49a3c lnworker.pay_to_node: make trampoline fee_level and failed_routes local
multiple instances of pay_to_node might run concurrently, esp for trampoline forwarding
2023-08-11 22:01:11 +00:00
SomberNight
35c9ac8f31 lnworker: MPP send: more aggressively split large htlcs
related: https://github.com/spesmilo/electrum/issues/7987#issuecomment-1670002482
2023-08-11 22:01:08 +00:00
SomberNight
8f768d1da5 lnworker.pay_to_node: log num htlcs in-flight 2023-08-11 22:01:05 +00:00
ThomasV
9f5f802cd1 config: save ports instead of net addresses (follow-up 012ce1c1bb) 2023-08-11 08:12:54 +02:00
SomberNight
2557474449 (trivial) fix typo in requirements-hw.txt
follow-up 9ea5193329
2023-08-10 18:06:59 +00:00
SomberNight
cc030c60e9 lnutil: make LnFeatures.supports() faster
LnFeatures.supports() is became part of the hot path of
LNPathFinder.find_path_for_payment()
in 6b43eac6fd,
which made find_path_for_payment considerably slower than before.
It used to take around 0.8 sec originally, then after linked commit went to ~9 sec,
and now this takes it down to ~1.1 sec (on my laptop).
2023-08-10 18:05:02 +00:00