1
0
Commit Graph

16451 Commits

Author SHA1 Message Date
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
Nikita Zhavoronkov
9f045e546f Add 3xpl.com to the list of explorers 2023-05-20 04:29:44 +06:00
SomberNight
e9475345e4 qml wizard: "confirm seed" screen to normalize whitespaces
fixes https://github.com/spesmilo/electrum/issues/8442
2023-05-17 15:19:41 +00:00
SomberNight
fd41308c6b network: log original error text in catch_server_exceptions
related: https://github.com/spesmilo/electrum/issues/8439
2023-05-16 15:10:12 +00:00
SomberNight
fc7c5dde6e qt SwapDialog: propagate errors from _create_tx
fixes https://github.com/spesmilo/electrum/issues/8430
2023-05-16 14:41:26 +00:00
accumulator
ac8a7a0784 channel_db: raise specific exception when channelDB not loaded, allowing lnworker to mark payment as failed. (#8431)
On mobile, it can take a while before channelDB is loaded. If payment is attempted before the DB
is fully loaded, this would result in a payment failure, but also leaves the payment attempt in IN_PROGRESS
state. This patch adds a more specific ChannelDBNotLoaded exception class, so we can handle this case more
gracefully, since we know the payment didn't succeed.
2023-05-16 13:08:26 +00:00
SomberNight
68eaa680f8 CLI/RPC: better error msg when running daemon on Windows
`-d` is not supported, due to missing os.fork

related: https://github.com/spesmilo/electrum/issues/5511
2023-05-16 12:28:59 +00:00
Ali Sherief
a7d3240bc2 Remove Localbitcoins provider 2023-05-16 10:06:55 +02:00
Sander van Grieken
1dd129c3e8 qml: remove logging ElCombobox 2023-05-15 16:51:49 +02:00
Sander van Grieken
5881eb3035 qml: LnurlPayRequestDialog validate amount between indicated boundaries 2023-05-15 16:47:19 +02:00
Sander van Grieken
229afdd887 qml: styling LnurlPayRequestDialog 2023-05-15 16:47:06 +02:00
Sander van Grieken
8d0fa27065 qml: remove unnecessary assert (#8420) 2023-05-15 16:45:15 +02:00
Sander van Grieken
4f252a438c qml: validate duplicate master key in WCBIP39Refine for BIP39 cosigner seeds (fixes #8432) 2023-05-15 14:45:21 +02:00