1
0
Commit Graph

17937 Commits

Author SHA1 Message Date
Sander van Grieken
26622a0de6 trustedcoin: inherit WalletWizardComponent instead of WizardComponent 2024-10-21 16:14:58 +02:00
Sander van Grieken
fd21a3bec2 qt: wizard: fix type hint, avoid shadowing builtin 'next' 2024-10-21 16:14:58 +02:00
SomberNight
bad965a2ac tests: test_wizard: fix warnings
```
=============================== warnings summary ===============================
tests/test_wizard.py::ServerConnectWizardTestCase::test_no_advanced
tests/test_wizard.py::ServerConnectWizardTestCase::test_proxy
tests/test_wizard.py::ServerConnectWizardTestCase::test_proxy_and_server
tests/test_wizard.py::ServerConnectWizardTestCase::test_server
tests/test_wizard.py::WalletWizardTestCase::test_2fa
tests/test_wizard.py::WalletWizardTestCase::test_create_standard_wallet_haveseed_bip39
tests/test_wizard.py::WalletWizardTestCase::test_create_standard_wallet_haveseed_electrum
tests/test_wizard.py::WalletWizardTestCase::test_create_standard_wallet_newseed
  /tmp/cirrus-ci-build/.tox/py3/lib/python3.10/site-packages/_pytest/threadexception.py:82: PytestUnhandledThreadExceptionWarning: Exception in thread Plugins

  Traceback (most recent call last):
    File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
      self.run()
    File "/tmp/cirrus-ci-build/electrum/plugin.py", line 360, in run
      self.on_stop()
    File "/tmp/cirrus-ci-build/electrum/util.py", line 430, in on_stop
      loop = get_asyncio_loop()
    File "/tmp/cirrus-ci-build/electrum/util.py", line 1578, in get_asyncio_loop
      raise Exception("event loop not created yet")
  Exception: event loop not created yet

    warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
```
2024-10-21 13:00:21 +00:00
accumulator
f9e342ebb2 Merge pull request #9254 from accumulator/tests_wizard
tests: initial wizard test cases
2024-10-21 14:13:46 +02:00
Sander van Grieken
974ad64688 trustedcoin: clean up imports, flake warnings 2024-10-21 14:11:18 +02:00
ghost43
3a2dfb34cf Merge pull request #9258 from SomberNight/202410_py313_ssl
interface: disable ssl.VERIFY_X509_STRICT for self-signed certs
2024-10-20 14:57:19 +00:00
SomberNight
b9a81cd03e lnworker: reserve wallet addresses also for chan backups
We were already reserving wallet addresses for full channels.
Now we also do the same for imported channel backups.
(but not for onchain, as we don't have enough info for that)

Without this, if the same seed is used on multiple devices (with each
device having its own set of LN channels), the wallet instances will
reuse keys (specifically the payment_basepoint, which for
static_remotekey chans is used as the to_remote output).
Now with this change, at least if the wallet instances have imported
channel backups of each other, this reuse is avoided.
2024-10-20 13:58:10 +00:00
SomberNight
4e47e07550 lnchannel: (trivial) add/fix type-hints 2024-10-20 13:55:33 +00:00
SomberNight
dd140df17d lnchannel: convert sweep_address property to get_sweep_address() method
no functional changes
2024-10-20 13:12:52 +00:00
SomberNight
ccc4cb7f57 follow-up prev: fix linter 2024-10-20 12:09:00 +00:00
SomberNight
cb0e234474 tests: test_lnpeer: extend close_upfront_shutdown_script
- make some checks more explicit, and
- explicitly test that closing tx pays to script specified by Bob using feature
2024-10-20 11:57:31 +00:00
SomberNight
63ae79ec4f exchange_rate: (trivial) add comments to Kraken(ExchangeBase) 2024-10-20 10:09:27 +00:00
SomberNight
92d6792b38 interface: disable ssl.VERIFY_X509_STRICT for self-signed certs
The "ssl.VERIFY_X509_STRICT" flag for openssl verification has been enabled by default in python 3.13+ (it was disabled before that).
see https://github.com/python/cpython/issues/107361
and https://discuss.python.org/t/ssl-changing-the-default-sslcontext-verify-flags/30230/16

We explicitly disable it for self-signed certs, thereby restoring the pre-3.13 defaults,
as it seems to break lots of servers.

For example, using python 3.13 (or setting `sslc.verify_flags |= ssl.VERIFY_X509_STRICT`),
- I can connect to `btc.electroncash.dk:60002:s`
- but not to `electrum.emzy.de:50002:s`
despite both using self-signed certs.

We should investigate more why exactly "strict" verification fails for some self-signed certs and not for others,
and make sure that at least newly generated certs adhere to the stricter requirements (e.g. update guide in e-x?).
2024-10-18 16:22:47 +00:00
ghost43
0fd4d9717e Merge pull request #9257 from SomberNight/202410_py313
ci: run tests also with python 3.13
2024-10-18 16:07:07 +00:00
SomberNight
c6a8b022bd ci: run tests also with python 3.13 2024-10-18 15:10:03 +00:00
SomberNight
fdc8430d40 bump libsecp256k1 version (0.5.0->0.5.1) 2024-10-18 14:47:15 +00:00
ThomasV
0ec60095f1 Merge pull request #9256 from spesmilo/rm_blocking_dialog
qt: replace BlockingWaitingDialog with RunCoroutineDialog
2024-10-18 16:05:19 +02:00
ThomasV
6635e40a2c confirm_tx dialog: provide feedback to the user when tx is not ready 2024-10-18 16:04:10 +02:00
ThomasV
2fd70d5d94 qt: replace BlockingWaitingDialog with RunCoroutineDialog
RunCoroutineDialog has a run() method that blocks the thread
without blocking the GUI (using exec), and a Cancel button
that cancels the coroutine.

main_window.run_coroutine_dialog() is a wrapper that returns
the coroutine result and may raise exceptions.

BlockingWaitingDialog was removed is transaction_dialog,
where it was not particularly useful.
2024-10-18 12:37:54 +02:00
SomberNight
3a28bb0957 follow-up prev: fix tests 2024-10-18 00:39:35 +00:00
SomberNight
8c160e1b97 lnpeer: maybe send update_fee right away after reestablish
I just had a channel force-closed over a fee-estimate-disagreement :(

Scenario:
1. started electrum, opened wallet
2. waited around 10 seconds, opened the lightning channels overview, saw that channels are open/ready
3. after around 10 more seconds, scanned bolt11 invoice and tried to pay
4. channel got force-closed

Before this commit, we only call maybe_update_fee via lnwatcher callbacks.
These callbacks trigger on events such as "adb_set_up_to_date", "blockchain_updated", "network_updated", "fee".
In my case there was a race that all these events triggered *before* the channel got reestablished
(in fact before the peer handshake finished). And also, by chance there were none of these events after
the reestablish but before I sent the HTLC.
When I sent the HTLC, the channel counterparty (eclair) sent back an "error" msg that the feerates are
too different, which led us to do a local-force-close.

I have other channels in this wallet (with other peers), which reestablished faster and got lucky with
timing: the lnwatcher callbacks came just in time to trigger update_fee for them.

```
20241017T222847.598163Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | handshake done for 03ecef675be448b615e6176424070673ef8284e0fd19d8be062a6cb5b130a0a0d1@lightning.electrum.org:9740
20241017T222847.602594Z |    DEBUG | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | Sending INIT
20241017T222847.641383Z |    DEBUG | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | Received INIT
20241017T222847.655041Z |    DEBUG | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | Sending CHANNEL_REESTABLISH
20241017T222847.658355Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | channel_reestablish (<redacted_shortchanid>): sent channel_reestablish with (next_local_ctn=157, oldest_unrevoked_remote_ctn=156)
20241017T222847.659524Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | reestablish_channel was called but channel <redacted_shortchanid> already in peer_state <PeerState.REESTABLISHING: 1>
20241017T222847.660491Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | reestablish_channel was called but channel <redacted_shortchanid> already in peer_state <PeerState.REESTABLISHING: 1>
20241017T222847.661442Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | reestablish_channel was called but channel <redacted_shortchanid> already in peer_state <PeerState.REESTABLISHING: 1>
20241017T222847.662768Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | reestablish_channel was called but channel <redacted_shortchanid> already in peer_state <PeerState.REESTABLISHING: 1>
20241017T222847.669875Z |    DEBUG | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | Received QUERY_CHANNEL_RANGE
20241017T222847.690318Z |    DEBUG | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | Received GOSSIP_TIMESTAMP_FILTER
20241017T222847.705782Z |    DEBUG | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | Received CHANNEL_REESTABLISH
20241017T222847.707932Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | channel_reestablish (<redacted_shortchanid>): received channel_reestablish with (their_next_local_ctn=157, their_oldest_unrevoked_remote_ctn=156)
20241017T222847.712504Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | channel_reestablish (<redacted_shortchanid>): replayed 0 unacked messages. []
20241017T222847.716096Z |    DEBUG | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | Sending CHANNEL_READY
20241017T222847.738709Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | saved remote channel_update gossip msg for chan <redacted_shortchanid>
20241017T222907.627447Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | lnpeer.pay len(route)=1
20241017T222907.628927Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] |   0: edge=<redacted_shortchanid> hop_data=<OnionHopsDataSingle. payload={<redacted>}. hmac=None>
20241017T222907.629184Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | adding trampoline onion to final payload
20241017T222907.629405Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | lnpeer.pay len(t_route)=2
20241017T222907.629653Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] |   0: t_node=03ecef675be448b615e6176424070673ef8284e0fd19d8be062a6cb5b130a0a0d1 hop_data=<OnionHopsDataSingle. payload={<redacted>}. hmac=<redacted>>
20241017T222907.629894Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] |   1: t_node=<redacted> hop_data=<OnionHopsDataSingle. payload={<redacted>}. hmac=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'>
20241017T222907.631495Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | starting payment. len(route)=1.
20241017T222907.633075Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | starting payment. htlc: UpdateAddHtlc(amount_msat=<redacted>, payment_hash=<redacted>, cltv_abs=<redacted>, timestamp=1729204147, htlc_id=66)
20241017T222907.633385Z |    DEBUG | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | Sending UPDATE_ADD_HTLC
20241017T222907.635118Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | send_commitment. chan <redacted_shortchanid>. ctn: 157.
20241017T222907.643229Z |    DEBUG | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | Sending COMMITMENT_SIGNED
20241017T222907.721929Z |    DEBUG | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | Received ERROR
20241017T222907.722621Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | remote peer sent error [DO NOT TRUST THIS MESSAGE]: 'local/remote feerates are too different: remoteFeeratePerKw=<redacted_low_val> localFeeratePerKw=50125'. chan_id=<redacted>. is_known_chan_id=True
20241017T222907.734272Z |    DEBUG | lnchannel.Channel.[<redacted_shortchanid>] | Setting channel state: OPEN -> FORCE_CLOSING
20241017T222907.825540Z |     INFO | lnpeer.Peer.[LNWallet, 03ecef675b-98960573] | Disconnecting: GracefulDisconnect()
```
2024-10-17 23:57:19 +00:00
SomberNight
e589444e55 exchange_rate: add historical rates for BitStamp 2024-10-17 18:26:47 +00:00
SomberNight
ccf20d24dd exchange_rate: add BitFinex, which has historical rates for usd and eur
yay

Given how few providers have free historical APIs, each one is very much appreciated.
They are doing a public service. Thanks. Not that they ever read commit messages. :)
2024-10-17 17:33:18 +00:00
SomberNight
2b10e103db exchange_rate: regenerate currencies.json 2024-10-17 16:48:48 +00:00
SomberNight
11be0637ca exchange_rate: fix regenerating currencies.json
```
cannot find currencies.json. will regenerate it now.
Traceback (most recent call last):
  File "...\electrum\run_electrum", line 94, in <module>
    from electrum.logging import get_logger, configure_logging  # import logging submodule first
  File "...\electrum\electrum\__init__.py", line 27, in <module>
    from . import daemon
  File "...\electrum\electrum\daemon.py", line 55, in <module>
    from .exchange_rate import FxThread
  File "...\electrum\electrum\exchange_rate.py", line 539, in <module>
    CURRENCIES = get_exchanges_and_currencies()
  File "...\electrum\electrum\exchange_rate.py", line 529, in get_exchanges_and_currencies
    loop = util.get_asyncio_loop()
  File "...\electrum\electrum\util.py", line 1578, in get_asyncio_loop
    raise Exception("event loop not created yet")
Exception: event loop not created yet
```
2024-10-17 16:48:31 +00:00
SomberNight
4b6c7af9b0 plugins: revealer: fix following qt6 migration
follow-up https://github.com/spesmilo/electrum/issues/8007
2024-10-17 16:36:11 +00:00
ThomasV
76d4fcec3c follow-up previous 2024-10-17 16:00:09 +02:00
ThomasV
853d90a804 trustedcoin plugin: fix path for qml (follow-up previous commit) 2024-10-17 13:50:16 +02:00
ThomasV
eccc5900e0 move plugin icons to plugins 2024-10-17 13:32:30 +02:00
Sander van Grieken
88d0ab300d tests: initial wizard test cases 2024-10-17 11:56:24 +02:00
ThomasV
d70996082e load_external_plugin: allow 'requires_wallet_type' 2024-10-17 10:47:11 +02:00
Sander van Grieken
0d22994277 trustedcoin: fix check in 2fa wallet setup, when not continuing a unfinished wallet (fixes #9253) 2024-10-16 23:06:51 +02:00
SomberNight
85b19ad0ea update release notes for version 4.5.6 2024-10-16 14:39:03 +00:00
SomberNight
e84679982e qt tx dlg: fix showing fee warnings
In qt, only the confirm_tx_dialog was showing the fee warnings, the transaction_dialog was not...

regression from bc3946d2f4
2024-10-16 12:42:58 +00:00
SomberNight
4bc63384d6 android readme: expand "how to debug repro failure" section 2024-10-15 23:42:44 +00:00
SomberNight
571acf71fe android: update p4a ref
- to include 0ab0d872e6
  > recipes: add patches for python3 recipes, for reproducible .pyc generation
  This should fix build repro of the apk.
2024-10-15 23:37:57 +00:00
Sander van Grieken
b8f12abfe4 qml: sweep: properly wrap text 2024-10-15 11:54:08 +02:00
ThomasV
267df91c0b send tab: catch exception raised if swap server is unreachable,
show error to the user.
(similar to main_window.run_swap_dialog)
2024-10-14 18:40:15 +02:00
SomberNight
e442a738e7 update block header checkpoints 2024-10-14 16:38:16 +00:00
ThomasV
8f11b5d411 swapserver: rm hardcoded value for percentage 2024-10-14 13:35:31 +02:00
Sander van Grieken
b22fb329cc coldcard: small fixes 2024-10-14 12:04:37 +02:00
accumulator
f7d3a850ba Merge pull request #9237 from accumulator/fix_2fa_keystore_only_encryption
trustedcoin: fix continuation of 2fa wallet file with keystore-only encryption
2024-10-14 11:50:18 +02:00
accumulator
5aa0d52121 Merge pull request #9248 from accumulator/issue7682_and_cc_bugs
coldcard: rebase #7682 and fix CC bugs
2024-10-14 11:43:30 +02:00
accumulator
d19f1f4790 Merge pull request #9245 from accumulator/qt_refactor_layouts_to_widgets
qt: refactor SeedLayout/KeysLayout to SeedWidget/KeysWidget, remove t…
2024-10-14 11:42:27 +02:00
Sander van Grieken
9e1c1bd0ad trustedcoin: fix continuation of 2fa wallet file with keystore-only encryption 2024-10-14 11:32:15 +02:00
ThomasV
3f85c7132a swapserver: add config variable SWAPSERVER_FEE_MILLIONTHS 2024-10-14 10:23:03 +02:00
ThomasV
5928dbbc47 qt normal swap dialog: do not use run_from_another_thread, as it is blocking 2024-10-13 09:53:14 +02:00
ThomasV
92d566f50e normal swaps message: put TLDR at the beginning! 2024-10-13 09:52:11 +02:00
avirgovi
572252abcd coldcard: rebase #7682 and fix CC bugs 2024-10-12 09:23:02 +02:00
SomberNight
ffdd45ee6f crypto: (trivial) add some type-hints 2024-10-12 03:51:59 +00:00