1
0

16463 Commits

Author SHA1 Message Date
SomberNight
1ca05f3243 update block header checkpoints 4.4.6 2023-08-17 15:47:24 +00:00
SomberNight
c66e603f96 prepare release 4.4.6 2023-08-17 15:37:03 +00:00
ThomasV
2cf6173cfc lnworker.create_routes_for_payment: fix MPP detection 2023-08-17 14:25:17 +00:00
SomberNight
9c86fd2a86 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:11:28 +00:00
SomberNight
893af0cdb5 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-17 11:43:38 +00:00
SomberNight
3e6580b94a util.CallbackManager: make sure exceptions in cbs are logged
this resolves the existing FIXME
2023-08-17 11:43:14 +00:00
SomberNight
1e6f0c2e77 qml: handle importChannelBackupFailed in WalletMainView
error was not being shown when scanning/pasting channel backup from Send screen
2023-08-17 11:40:15 +00:00
SomberNight
7d16e72fa7 interface: log: silence some tracebacks
```
191.73 | D | i/interface.[btc.electroncash.dk:60002] | (disconnect) trace for RPCError(-32603, 'internal error: bitcoind request timed out')
Traceback (most recent call last):
  File "...\electrum\electrum\interface.py", line 514, in wrapper_func
    return await func(self, *args, **kwargs)
  File "...\electrum\electrum\interface.py", line 537, in run
    await self.open_session(ssl_context)
  File "...\electrum\electrum\interface.py", line 687, in open_session
    async with self.taskgroup as group:
  File "...\aiorpcX\aiorpcx\curio.py", line 304, in __aexit__
    await self.join()
  File "...\electrum\electrum\util.py", line 1309, in join
    task.result()
  File "...\electrum\electrum\interface.py", line 724, in request_fee_estimates
    async with OldTaskGroup() as group:
  File "...\aiorpcX\aiorpcx\curio.py", line 304, in __aexit__
    await self.join()
  File "...\electrum\electrum\util.py", line 1309, in join
    task.result()
  File "...\electrum\electrum\interface.py", line 1128, in get_estimatefee
    res = await self.session.send_request('blockchain.estimatefee', [num_blocks])
  File "...\electrum\electrum\interface.py", line 169, in send_request
    response = await util.wait_for2(
  File "...\electrum\electrum\util.py", line 1383, in wait_for2
    return await asyncio.ensure_future(fut, loop=get_running_loop())
  File "...\aiorpcX\aiorpcx\session.py", line 540, in send_request
    return await self._send_concurrent(message, future, 1)
  File "...\aiorpcX\aiorpcx\session.py", line 512, in _send_concurrent
    return await future
aiorpcx.jsonrpc.RPCError: (-32603, 'internal error: bitcoind request timed out')
```

```
 93.60 | E | asyncio | Task exception was never retrieved
future: <Task finished name='Task-7385' coro=<Interface.get_estimatefee() done, defined at ...\electrum\electrum\interface.py:1123> exception=RPCError(-32603, 'internal error: bitcoind request timed out')>
Traceback (most recent call last):
  File "...\electrum\electrum\interface.py", line 1132, in get_estimatefee
    res = await self.session.send_request('blockchain.estimatefee', [num_blocks])
  File "...\electrum\electrum\interface.py", line 169, in send_request
    response = await util.wait_for2(
  File "...\electrum\electrum\util.py", line 1383, in wait_for2
    return await asyncio.ensure_future(fut, loop=get_running_loop())
  File "...\aiorpcX\aiorpcx\session.py", line 540, in send_request
    return await self._send_concurrent(message, future, 1)
  File "...\aiorpcX\aiorpcx\session.py", line 512, in _send_concurrent
    return await future
aiorpcx.jsonrpc.RPCError: (-32603, 'internal error: bitcoind request timed out')
```
2023-08-17 11:39:57 +00:00
SomberNight
844b5b1c24 CLI: fix regression re handling "unknown command", re locale
if qt is not installed, e.g. on a server, was getting:
```
$ ./run_electrum sadasdasddsa
Traceback (most recent call last):
  File "/home/user/wspace/electrum/./run_electrum", line 532, in <module>
    main()
  File "/home/user/wspace/electrum/./run_electrum", line 383, in main
    lang = get_default_language(gui_name=gui_name)
  File "/home/user/wspace/electrum/electrum/gui/default_lang.py", line 23, in get_default_language
    from PyQt5.QtCore import QLocale
ModuleNotFoundError: No module named 'PyQt5.QtCore'
```
2023-08-17 11:38:20 +00:00
SomberNight
3ecde4593b lnworker.pay_invoice: log more
related https://github.com/spesmilo/electrum/issues/7987#issuecomment-1670002482
2023-08-17 11:36:25 +00:00
SomberNight
c5300c9f1c lnworker: add RecvMPPResolution with "FAILED" state
- add RecvMPPResolution enum for possible states of a pending incoming MPP,
  and use it in check_mpp_status
  - new state: "FAILED", to allow nicely failing back the whole MPP set
- key more things with payment_hash+payment_secret, for consistency
  (just payment_hash is insufficient for trampoline forwarding)
2023-08-17 11:35:37 +00:00
SomberNight
a4a184c6f5 CI: don't run unit tests on "python:rc", looks like it's unmaintained
The "python:rc" tag on dockerhub has not been updated for 2+ years
and is still at 3.10.0rc2. Even 3.11 has been released for many months now.
see https://hub.docker.com/_/python/tags
2023-08-17 11:32:13 +00:00
SomberNight
5d47c0c56c follow-up ImportedChannelBackup changes: fix opening wallet w/ old cbs
follow-up https://github.com/spesmilo/electrum/pull/8536

```
  1.52 | E | gui.qt.ElectrumGui |
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/__init__.py", line 342, in start_new_window
    wallet = self.daemon.load_wallet(path, None)
  File "/home/user/wspace/electrum/electrum/daemon.py", line 469, in func_wrapper
    return func(self, *args, **kwargs)
  File "/home/user/wspace/electrum/electrum/daemon.py", line 479, in load_wallet
    wallet = self._load_wallet(path, password, manual_upgrades=manual_upgrades, config=self.config)
  File "/home/user/wspace/electrum/electrum/util.py", line 466, in do_profile
    o = func(*args, **kw_args)
  File "/home/user/wspace/electrum/electrum/daemon.py", line 504, in _load_wallet
    db = WalletDB(storage.read(), manual_upgrades=manual_upgrades)
  File "/home/user/wspace/electrum/electrum/wallet_db.py", line 117, in __init__
    self._after_upgrade_tasks()
  File "/home/user/wspace/electrum/electrum/wallet_db.py", line 247, in _after_upgrade_tasks
    self._load_transactions()
  File "/home/user/wspace/electrum/electrum/util.py", line 466, in do_profile
    o = func(*args, **kw_args)
  File "/home/user/wspace/electrum/electrum/wallet_db.py", line 1536, in _load_transactions
    self.data = StoredDict(self.data, self, [])
  File "/home/user/wspace/electrum/electrum/json_db.py", line 117, in __init__
    self.__setitem__(k, v)
  File "/home/user/wspace/electrum/electrum/json_db.py", line 49, in wrapper
    return func(self, *args, **kwargs)
  File "/home/user/wspace/electrum/electrum/json_db.py", line 135, in __setitem__
    v = self.db._convert_dict(self.path, key, v)
  File "/home/user/wspace/electrum/electrum/json_db.py", line 247, in _convert_dict
    v = dict((k, constructor(**x)) for k, x in v.items())
  File "/home/user/wspace/electrum/electrum/json_db.py", line 247, in <genexpr>
    v = dict((k, constructor(**x)) for k, x in v.items())
TypeError: ImportedChannelBackupStorage.__init__() missing 1 required positional argument: 'local_payment_pubkey'
```
2023-08-17 11:31:39 +00:00
3rd Iteration
1c0f358433 Add Vendor/Device IDs for CH340 based DIY Jade devices. (#8546)
* Add Vendor/Device IDs for CH340 based DIY Jade devices.

* Add device descriptions to hardwareIDs
2023-08-17 11:27:53 +00:00
SomberNight
ebc4a00e3b util.CallbackManager: keep strong references for running futures
This clears up log spam for regtest tests.

related:
- https://bugs.python.org/issue44665
- https://github.com/python/cpython/issues/88831
- https://textual.textualize.io/blog/2023/02/11/the-heisenbug-lurking-in-your-async-code/
- https://github.com/python/cpython/issues/91887#issuecomment-1434816045
- "Task was destroyed but it is pending!"

Perhaps we should inspect all our usages of
- asyncio.create_task
- loop.create_task
- asyncio.ensure_future
- asyncio.run_coroutine_threadsafe
?

Example log for running a regtest test:
```
$ python3 -m unittest electrum.tests.regtest.TestLightningAB.test_collaborative_close
***** test_collaborative_close ******
initializing alice
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 1100, in emit
    msg = self.format(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 943, in format
    return fmt.format(record)
  File "/home/user/wspace/electrum/electrum/logging.py", line 44, in format
    record = copy.copy(record)  # avoid mutating arg
  File "/usr/lib/python3.10/copy.py", line 92, in copy
    rv = reductor(4)
ImportError: sys.meta_path is None, Python is likely shutting down
Call stack:
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1781, in call_exception_handler
    self._exception_handler(self, context)
  File "/home/user/wspace/electrum/electrum/util.py", line 1535, in on_exception
    loop.default_exception_handler(context)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1744, in default_exception_handler
    logger.error('\n'.join(log_lines), exc_info=exc_info)
Message: "Task was destroyed but it is pending!\ntask: <Task pending name='Task-2' coro=<Abstract_Wallet.on_event_adb_set_up_to_date() running at /home/user/wspace/electrum/electrum/wallet.py:485> wait_for=<Future finished result=0> cb=[_chain_future.<locals>._call_set_state() at /usr/lib/python3.10/asyncio/futures.py:392]>"
Arguments: ()

[--- SNIP --- more of the same --- SNIP ---]

--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 1100, in emit
    msg = self.format(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 943, in format
    return fmt.format(record)
  File "/home/user/wspace/electrum/electrum/logging.py", line 44, in format
    record = copy.copy(record)  # avoid mutating arg
  File "/usr/lib/python3.10/copy.py", line 92, in copy
    rv = reductor(4)
ImportError: sys.meta_path is None, Python is likely shutting down
Call stack:
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1781, in call_exception_handler
    self._exception_handler(self, context)
  File "/home/user/wspace/electrum/electrum/util.py", line 1535, in on_exception
    loop.default_exception_handler(context)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1744, in default_exception_handler
    logger.error('\n'.join(log_lines), exc_info=exc_info)
Message: "Task was destroyed but it is pending!\ntask: <Task pending name='Task-31' coro=<Abstract_Wallet.on_event_adb_set_up_to_date() running at /home/user/wspace/electrum/electrum/wallet.py:485> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib/python3.10/asyncio/futures.py:385, Task.task_wakeup()]> cb=[_chain_future.<locals>._call_set_state() at /usr/lib/python3.10/asyncio/futures.py:392]>"
Arguments: ()
true
true
true
true
funding alice
```
2023-08-17 11:27:02 +00:00
SomberNight
803a7ec19e tests: make regtest tests somewhat faster by faster polling in e-x
using 4e66804dc0

on my machine, before-after:
Ran 9 tests in 495.865s
Ran 9 tests in 376.183s
2023-08-17 11:26:40 +00:00
SomberNight
d6974caca3 fix sweeping chan after local force-close using cb
scenario:
- user opens a lightning channel and exports an "imported channel backup"
- user closes channel via local-force-close
  - local ctx is published, to_local output has user's funds and they are CSV-locked for days
- user restores wallet file from seed and imports channel backup
- new wallet file should be able to sweep coins from to_local output (after CSV expires)

This was not working previously, as the local_payment_basepoint was not included in the
imported channel backups, and the code was interpreting the lack of this as the channel not
having option_static_remotekey enabled. This resulted in lnutil.extract_ctn_from_tx
using an incorrect funder_payment_basepoint, and lnsweep not recognising the ctx due to
the garbage ctn value.

The imported channel backup serialisation format is slightly changed to include the
previously missing field, and its version number is bumped (0->1). We allow importing
both version 0 and version 1 backups, however v0 backups cannot handle the above
described scenario (they can only be used to request a remote-force-close).

Note that we were/are setting the missing local_payment_basepoint to the pubkey of
one of the wallet change addresses, which is bruteforceable if necessary, but I
think it is not worth the complexity to add this bruteforce logic. Also note
that the bruteforcing could only be done after the local-force-close was broadcast.

Ideally people with existing channels and already exported v0 backups should re-export
v1 backups... Not sure how to handle this.

closes https://github.com/spesmilo/electrum/issues/8516
2023-08-17 11:26:23 +00:00
SomberNight
44546c0a08 tests: add failing test for sweeping chan after local fclose using cb 2023-08-17 11:26:11 +00:00
Sander van Grieken
d03ffc85a2 allow more time to detect tor 2023-08-17 11:23:46 +00:00
SomberNight
1786609fc7 build: include AppStream metainfo.xml in tarballs
closes https://github.com/spesmilo/electrum/issues/8501
related https://github.com/spesmilo/electrum/pull/8149
2023-08-17 11:22:58 +00:00
Sander van Grieken
0efbed16bc qml: remember invoice/qr type on ReceiveDialog 2023-08-17 11:21:37 +00:00
Sander van Grieken
846ff0da09 qml: show backup type, as in qt 2023-08-17 11:21:01 +00:00
SomberNight
82e8c95696 qml: fix "copy" and "share" buttons for channel backup dialogs
The QR code was shown but the copy/share buttons did not do anything.
2023-08-17 11:20:34 +00:00
Sander van Grieken
4576049b50 qml: strip whitespace of data pasted/scanned before processing 2023-08-17 11:19:37 +00:00
SomberNight
6523a73ac5 lnaddr: add LnAddr.to_debug_json() method 2023-08-17 11:14:19 +00:00
SomberNight
5b4df75918 qml: fix lnurl-pay when config.BTC_AMOUNTS_ADD_THOUSANDS_SEP is True
when paying an lnurl-pay that provides an amount interval,
the amount field is editable by the user and it expects no spaces
2023-08-17 11:12:25 +00:00
SomberNight
c327f9ee51 contrib/docker_notes.md: add notes re debian apt mirror, and envvars
related https://github.com/spesmilo/electrum/issues/8496
2023-08-17 11:10:42 +00:00
Sander van Grieken
c8d29d59d0 trezor: model T is 'T', not '2' 2023-07-07 14:01:18 +02:00
Sander van Grieken
d3bebcda35 trezor: allow PIN of length 50 for T1 firmware >=1.10.0 and TT firmware >=2.4.0 (closes #8526) 2023-07-07 12:36:31 +02:00
Sander van Grieken
9e219faa0d qml: add PIN auth to close channel operation. 2023-07-04 14:06:32 +02:00
Sander van Grieken
d6e0684a7f qml: show channel backup and explanatory message before local force close, and let user confirm before doing the close operation
also show message dialog after close succeeded instead of just closing the channel close dialog
2023-07-04 13:07:28 +02:00
SomberNight
5d5def2ef4 commands: onchain_history: reuse daemon.fx if available 4.4.5 2023-06-19 16:03:51 +00:00
SomberNight
951199ffc3 update locale 2023-06-19 16:02:09 +00:00
SomberNight
eaaedada67 prepare release 4.4.5 2023-06-19 15:52:32 +00:00
SomberNight
176f05e5c3 trustedcoin: stricter client-side checks for 2fa fee 2023-06-14 01:01:52 +00:00
Thomas LÉVEIL
40c09dbe6c 🐛 fix #8469 - fiat balance sorting (#8478)
in address list window
2023-06-14 01:00:39 +00:00
SomberNight
2af3c2a281 lnworker: fix rebalance_channels
fixes https://github.com/spesmilo/electrum/issues/8468
2023-06-04 03:09:17 +00:00
Sander van Grieken
d184de9a6a payserver: fix import 2023-06-02 13:57:20 +00:00
SomberNight
13f7ec67cc fix flake8: follow-up prev 2023-06-02 13:57:17 +00:00
SomberNight
d1c881080f unconditionally raise ImportError if asserts are disabled
I have reconsidered and now think that we should always hard-fail
if asserts asserts are disabled. It is just easier to reason about
the code knowing that asserts are evaluated.

If an end-user or library user has a concrete use case where this is
a problem, please open an issue and let us know.

follow-up
0f541be6f1
0e5464ca13
2023-06-02 13:57:12 +00:00
SomberNight
2752cd2183 jade(hw): fix sign_transaction()
same as 9e13246be8

fixes https://github.com/spesmilo/electrum/issues/8463
regression from https://github.com/spesmilo/electrum/pull/8230
2023-06-02 13:55:08 +00:00
SomberNight
6374ef248f prepare release 4.4.4 4.4.4 2023-05-31 12:54:31 +00:00
SomberNight
44c752c456 update locale 2023-05-31 12:51:36 +00:00
SomberNight
8d77db6ade (trivial) qt wizard: add title to seed options dialog window 2023-05-31 12:00:27 +00:00
Sander van Grieken
6d8ace4abe qml: make ConfirmTxDialog flickable if content larger than window (fixes #8446) 2023-05-31 12:00:23 +00:00
SomberNight
10574bb14d bump libsecp256k1 version 2023-05-31 12:00:19 +00:00
ThomasV
250b14cb6e Merge pull request #8450 from SomberNight/202305_website_nojs
contrib/make_download: adapt to downloads being merged into index.html
2023-05-24 15:51:46 +02:00
SomberNight
3861b7c152 contrib/make_download: adapt to downloads being merged into index.html
see https://github.com/spesmilo/electrum-web/pull/20
2023-05-22 13:12:26 +00:00
ThomasV
fda408e4e4 Merge pull request #8444 from Har01d/add-3xpl-as-explorer
Add 3xpl.com to the list of explorers
2023-05-21 11:17:21 +02:00
SomberNight
603088a79f util: simplify profiler 2023-05-19 23:03:27 +00:00