1
0
Commit Graph

1527 Commits

Author SHA1 Message Date
SomberNight
a674f63ce3 qt channels list: add TODO
(noticed on regtest)
2023-08-03 17:21:08 +00:00
ThomasV
4d84769096 Qt: Show notification instead of popup if a lightning payment fails. 2023-07-24 17:56:20 +02:00
Sander van Grieken
0d7ff92c43 send_tab: remove payment_identifier comments in send_tab 2023-07-11 19:54:07 +02:00
Sander van Grieken
40f15b158c payment_identifier: reconstruct PI for bip70 invoice in pay_onchain_dialog instead of taking the send_tab PI 2023-07-11 17:16:27 +02:00
Sander van Grieken
d15050a2bf payment_identifier: fix _on_finalize params, fix lnurlp send comment instead of description,
refactor payment_identifier.get_invoice to standalone invoice_from_payment_identifier
2023-07-11 14:15:17 +02:00
SomberNight
bb8c73cabd qt: kind of fix bip70 notify_merchant logic by passing around PI
```
229.18 | E | gui.qt.main_window.[test_segwit_2] | on_error
Traceback (most recent call last):
  File "...\electrum\gui\qt\util.py", line 917, in run
    result = task.task()
  File "...\electrum\gui\qt\send_tab.py", line 681, in broadcast_thread
    if self.payto_e.payment_identifier.has_expired():
AttributeError: 'NoneType' object has no attribute 'has_expired'
```

In SendTab.broadcast_transaction.broadcast_thread, self.payto_e.payment_identifier was referenced -
but do_clear() has already cleared it by then.
E.g. consider SendTab.pay_onchain_dialog: it calls save_pending_invoice(), which calls do_clear(),
and later (in sign_done), it calls window.broadcast_or_show, which will call SendTab.broadcast_transaction().

As there might be multiple independent transaction dialogs open simultaneously, the single shared state
send_tab.payto_e.payment_identifier approach was problematic -- I think it is conceptually nicer to
pass around the payment_identifiers as needed, as done with this change.

However, this change is not a full proper fix, as it still somewhat relies on
send_tab.payto_e.payment_identifier (e.g. in pay_onchain_dialog). Hence, e.g. when using
the invoice_list context menu "Pay..." item, as payto_e.payment_identifier is not set,
payment_identifier will be None in broadcast_transaction.

but at least we handle PI being None gracefully -- before this change, broadcast_transaction
expected PI to be set, and it was never set to the correct thing (as do_clear() already ran by then):
depending on timing it was either None or a new empty PI. In the former case, producing the above
traceback and hard failing (not only for bip70 stuff!), and in the latter, silently ignoring the logic bug.
2023-07-10 18:16:56 +00:00
SomberNight
612a8e6424 qt: fix: bip70 pay reqs need x509 verification
regression from https://github.com/spesmilo/electrum/pull/8462

- pr.verify() was called in qml, but not in qt gui
- we now call pr.verify() in get_payment_request(), to make the API less error-prone
- it is now ok to call pr.verify() multiple times, the result is cached
2023-07-10 17:50:53 +00:00
Sander van Grieken
ae8c4f1281 payment_identifier: check if payment identifier is usable and enable/disable Send/Pay buttons 2023-07-08 12:19:37 +02:00
Sander van Grieken
f980bd97b5 payment_identifier: factor out bip21 functions to bip21.py to break cyclic dependencies,
parse bolt11 only once, store invoice internally instead of bolt11 string
add is_onchain method to indicate if payment identifier can be paid onchain
2023-07-08 12:18:37 +02:00
Sander van Grieken
db6779bf04 qt: show send tab if payment identifier is passed on the cmdline 2023-07-07 20:49:45 +02:00
ThomasV
9b41bcf992 setFrozen: use light blue, black text is difficult to read on a blue background 2023-07-07 17:05:08 +02:00
Sander van Grieken
b6010aad0f paytoedit: promote to QWidget and encapsulate QLineEdit vs QTextEdit juggling 2023-07-03 16:33:07 +02:00
Sander van Grieken
81544fdaed send_tab: simplify lock_recipient check 2023-06-28 16:49:28 +02:00
Sander van Grieken
30abcad999 payment_identifier: move amount_range into payment_identifier 2023-06-28 16:49:28 +02:00
Sander van Grieken
49dab82efa send_tab: add spinner for network lookup indication 2023-06-28 16:49:28 +02:00
Sander van Grieken
febb2222d4 send_tab: simplify lock_max 2023-06-28 16:49:28 +02:00
Sander van Grieken
3df13b8ce4 qt: disallow save of LNURLp/LnAddr 2023-06-28 16:49:28 +02:00
Sander van Grieken
6b57743c3e send_tab: add LNURLp range as tooltip on amount field 2023-06-28 16:49:28 +02:00
Sander van Grieken
fbb37d6fae payment_identifier: add DOMAINLIKE payment identifier type, support domainlike -> openalias 2023-06-28 16:49:28 +02:00
Sander van Grieken
0cbf403f8b use NamedTuple for payment identifier gui fields 2023-06-28 16:49:28 +02:00
Sander van Grieken
3a1e5244b8 qt: fix enable/disable max button for openalias and restrict openalias to address only 2023-06-28 16:49:28 +02:00
Sander van Grieken
eed016bd7e qt: move setting frozen styling to edit components themselves, fix re-enabling Clear button after finalize 2023-06-28 16:49:28 +02:00
Sander van Grieken
74a1f38a8b payment identifier types as enum 2023-06-28 16:49:28 +02:00
Sander van Grieken
915f66c0b8 payment_identifier: fix emaillike
qt: validate on pushback timer, buttons enable/disable, cleanup
2023-06-28 16:49:28 +02:00
Sander van Grieken
bde066f9ce qt: refactor send_tab, paytoedit 2023-06-28 16:49:28 +02:00
Sander van Grieken
d9a43fa6ed refactor last callback, signals. remove timered validate, don't add invalid address/amount to outputs 2023-06-28 16:49:28 +02:00
Sander van Grieken
b1925f8747 payment_identifier: refactor round_3 to need_merchant_notify/notify_merchant 2023-06-28 16:49:28 +02:00
Sander van Grieken
7601726d29 payment_identifier: refactor round_2 to need_finalize/finalize stage 2023-06-28 16:49:28 +02:00
Sander van Grieken
508d1038d3 payment_identifier: define states, refactor round_1 into resolve stage 2023-06-28 16:49:28 +02:00
Sander van Grieken
a2ca191de1 pass wallet to PaymentIdentifier instead of config and contacts 2023-06-28 16:49:28 +02:00
Sander van Grieken
cbd388c297 fix flake8 issues (undefined references) 2023-06-28 16:49:28 +02:00
ThomasV
15eb765eac payment_identifiers:
- this separates GUI from core handling
 - the PaymentIdentifier class handles network requests
 - the GUI is agnostic about the type of PI
2023-06-28 16:49:28 +02:00
SomberNight
c85139009a qt chan details dlg: make some more labels selectable 2023-06-23 20:02:25 +00:00
SomberNight
ca93af2b8a ln: some clean-up for option_scid_alias
- qt chan details dlg: show both local and remote aliases
- lnchannel: more descriptive names, add clarification in doctstrings,
  and also save the "local_scid_alias" in the wallet file (to remember if
  we sent it)
- lnpeer:
  - resend channel_ready msg after reestablish, to upgrade old existing channels
    to having local_scid_alias
  - forwarding bugfix, to follow BOLT-04:
    > - if it returns a `channel_update`:
    >   - MUST set `short_channel_id` to the `short_channel_id` used by the incoming onion.
2023-06-23 19:51:57 +00:00
SomberNight
23f2412da7 qt: follow-up "rm thousand sep when copying numbers to clipboard"
follow-up https://github.com/spesmilo/electrum/pull/8479
2023-06-13 15:59:18 +00:00
ThomasV
5b5100eedc Merge pull request #8479 from thomasleveil/feat_copy_numbers
 remove thousand separator when copying numbers to clipboard
2023-06-13 14:40:17 +02:00
Thomas LÉVEIL
1b07472805 🐛 fix #8469 - fiat balance sorting (#8478)
in address list window
2023-06-12 22:39:31 +00:00
Thomas
cdab59f620 remove thousand separator when copying numbers to clipboard
from contextual menus
2023-06-11 23:55:10 +02:00
SomberNight
1c0ba83d10 (trivial) qt wizard: add title to seed options dialog window 2023-05-31 10:58:54 +00:00
SomberNight
328a2bb3f2 config: migrate qt gui optional tabs to config vars 2023-05-30 14:04:20 +00:00
SomberNight
24980feab7 config: introduce ConfigVars
A new config API is introduced, and ~all of the codebase is adapted to it.
The old API is kept but mainly only for dynamic usage where its extra flexibility is needed.

Using examples, the old config API looked this:
```
>>> config.get("request_expiry", 86400)
604800
>>> config.set_key("request_expiry", 86400)
>>>
```

The new config API instead:
```
>>> config.WALLET_PAYREQ_EXPIRY_SECONDS
604800
>>> config.WALLET_PAYREQ_EXPIRY_SECONDS = 86400
>>>
```

The old API operated on arbitrary string keys, the new one uses
a static ~enum-like list of variables.

With the new API:
- there is a single centralised list of config variables, as opposed to
  these being scattered all over
- no more duplication of default values (in the getters)
- there is now some (minimal for now) type-validation/conversion for
  the config values

closes https://github.com/spesmilo/electrum/pull/5640
closes https://github.com/spesmilo/electrum/pull/5649

Note: there is yet a third API added here, for certain niche/abstract use-cases,
where we need a reference to the config variable itself.
It should only be used when needed:
```
>>> var = config.cv.WALLET_PAYREQ_EXPIRY_SECONDS
>>> var
<ConfigVarWithConfig key='request_expiry'>
>>> var.get()
604800
>>> var.set(3600)
>>> var.get_default_value()
86400
>>> var.is_set()
True
>>> var.is_modifiable()
True
```
2023-05-25 17:39:48 +00:00
SomberNight
03ab33f4b2 SimpleConfig: change API of set_key(): "save" is now kwarg-only 2023-05-25 17:37:16 +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
SomberNight
68fb996d20 wallet_db version 52: break non-homogeneous multisig wallets
- case 1: in version 4.4.1, 4.4.2, the qml GUI wizard allowed creating multisig wallets with an old_mpk as cosigner.
- case 2: in version 4.4.0, 4.4.1, 4.4.2, the qml GUI wizard allowed creating multisig wallets with mixed xpub/Ypub/Zpub.

The corresponding missing input validation was a bug in the wizard, it was unintended behaviour. Validation was added in d2cf21fc2b. Note however that there might be users who created such wallet files.

Re case 1 wallet files: there is no version of Electrum that allows spending from such a wallet. Coins received at addresses are not burned, however it is technically challenging to spend them. (unless the multisig can spend without needing the old_mpk cosigner in the quorum).

Re case 2 wallet files: it is possible to create a corresponding spending wallet for such a multisig, however it is a bit tricky. The script type for the addresses in such a heterogeneous xpub wallet is based on the xpub_type of the first keystore. So e.g. given a wallet file [Yprv1, Zpub2] it will have sh(wsh()) scripts, and the cosigner should create a wallet file [Ypub1, Zprv2] (same order).

Technically case 2 wallet files could be "fixed" automatically by converting the xpub types as part of a wallet_db upgrade. However if the wallet files also contain seeds, those cannot be converted ("standard" vs "segwit" electrum seed).
Case 1 wallet files are not possible to "fix" automatically as the cosigner using the old_mpk is not bip32 based.

It is unclear if there are *any* users out there affected by this. I suspect for case 1 it is very likely there are none (not many people have pre-2.0 electrum seeds which were never supported as part of a multisig who would also now try to create a multisig using them); for case 2 however there might be.

This commit breaks both case 1 and case 2 wallets: these wallet files can no longer be opened in new Electrum, an error message is shown and the crash reporter opens. If any potential users opt to send crash reports, at least we will know they exist and can help them recover.
2023-05-11 14:26:11 +00:00
SomberNight
b40a608b74 qt: persist addresses tab toolbar "show/hide" state, like in 4.3.4 2023-05-09 01:14:11 +00:00
SomberNight
a0c43573ab locale/i18n: get default language and set it as early as possible
TODO elaborate xxxxx
2023-05-05 17:00:18 +00:00
SomberNight
9c47144418 qt: handle expected errors in DSCancelDialog
closes https://github.com/spesmilo/electrum/issues/8390
2023-05-05 16:06:16 +00:00
SomberNight
3bdda3a861 config: force 'history_rates' config var to bool
fixes https://github.com/spesmilo/electrum/issues/8367

probably regression from 503776c0de
(note that before that commit, we were casting to bool)
2023-05-03 12:18:34 +00:00
ThomasV
6d392a67f9 wallet.get_tx_parents: populate cache regardless of self.is_up_to_date()
Fixes #8315
2023-05-02 09:11:21 +02:00
SomberNight
ad5f95cb87 util.profiler: add "min_threshold" arg 2023-04-26 14:49:37 +00:00