1
0
Commit Graph

2956 Commits

Author SHA1 Message Date
SomberNight
4c63d8729b add sanity checks we don't sign tx including dummy addr
Somewhat a follow-up to 649ce979ab.

This adds some safety belts so we don't accidentally sign a tx that
contains a dummy address.
Specifically we check that tx does not contain output for dummy addr:
- in wallet.sign_transaction
- in network.broadcast_transaction

The second one is perhaps redundant, but I think it does not hurt.
2023-09-16 04:36:08 +00:00
SomberNight
956b455954 qt tx dlg: follow-up "send tx change to lightning"
lnworker is None if lightning is disabled.
follow-up 649ce979ab

```
 15.14 | E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\rate_limiter.py", line 231, in wrapper
    return RateLimiter.invoke(rate, ts_after, func, args, kwargs)
  File "...\electrum\electrum\gui\qt\rate_limiter.py", line 79, in invoke
    return rl._invoke(args, kwargs)
  File "...\electrum\electrum\gui\qt\rate_limiter.py", line 91, in _invoke
    return self._doIt()
  File "...\electrum\electrum\gui\qt\rate_limiter.py", line 120, in _doIt
    retval = self.func(*args, **kwargs) # and.. call the function. use latest invocation's args
  File "...\electrum\electrum\gui\qt\transaction_dialog.py", line 745, in _throttled_update
    self.update()
  File "...\electrum\electrum\gui\qt\transaction_dialog.py", line 750, in update
    self.io_widget.update(self.tx)
  File "...\electrum\electrum\gui\qt\transaction_dialog.py", line 243, in update
    insert_tx_io(
  File "...\electrum\electrum\gui\qt\transaction_dialog.py", line 205, in insert_tx_io
    tcf_addr = addr_text_format(addr)
  File "...\electrum\electrum\gui\qt\transaction_dialog.py", line 173, in addr_text_format
    sm = self.wallet.lnworker.swap_manager
AttributeError: 'NoneType' object has no attribute 'swap_manager'
```
2023-09-16 02:21:23 +00:00
Sander van Grieken
24f27618e2 qml: handle no wallet password for authed info 2023-09-15 11:42:49 +02:00
ThomasV
1e96bbc1e8 fix typo (follow-up previous commit) 2023-09-14 16:05:36 +02:00
ThomasV
d03c77837f Let the GUI compute the balance displayed in history.
Since Qt groups swap transactions, the displayed balance
was sometimes incorrect.
2023-09-14 15:58:58 +02:00
ThomasV
9df8bb61a5 Give users an option to cancel a submarine swap while awaiting HTLCs.
Note that HTLCs must not be cancelled after the funding transaction
has been broadcast. If one want to cancel a swap once the funding
transaction is in mempool, one should double spend the transaction.
2023-09-13 16:28:31 +02:00
Sander van Grieken
58dbe6690d qml: create ElCombBox and ElRadioButton that automatically word wrap their text element. Fixes #8611 2023-09-12 17:56:35 +02:00
SomberNight
139eb632d7 (trivial) follow-up paysession.use_two_trampolines arg change
follow-up b2053c68f1

- use_two_trampolines is already passed as arg to init
- strings in gui/messages.py should not end with a newline
2023-09-12 14:05:12 +00:00
ThomasV
aade0e8ef9 disable option SEND_CHANGE_TO_LIGHTNING if we are already doing a swap 2023-09-11 10:46:37 +02:00
ThomasV
649ce979ab send tx change to lightning 2023-09-09 14:14:43 +02:00
SomberNight
976f06f3c6 follow-up kivy removal: rm kivy/theming submodule
Looks like this was not fully removed.

$ git rm --force electrum/gui/kivy/theming/atlas

follow-up b45c84f24f
see https://github.com/spesmilo/electrum/pull/8591
2023-09-06 16:11:04 +00:00
SomberNight
1dd4acce9c Merge branch '202308_rm_kivy'
(PR https://github.com/spesmilo/electrum/pull/8591)
2023-09-06 13:35:57 +00:00
Sander van Grieken
307cf25fd4 register distinction between address and script for SPK type payment identifiers and allow zero amount for
script destinations.

This is mainly to support OP_RETURN outputs, which typically have a zero amount output value,
but as we don't special case OP_RETURN, this is currently done for all non-address scripts

Also, it's probably good to add a warning popup for OP_RETURN outputs with a non-zero output value, but this
would also need special casing for OP_RETURN.

Saving of script output payment identifiers is disabled for now, as reading the script from the stored invoice
back into human-readable form is currently not implemented, and currently only lightning invoices or address output
is supported.
2023-09-04 20:00:40 +02:00
Sander van Grieken
0d96bc1dbd qt/send_tab: fix regressions paymentidentifier
Fix '!' amount expand while PaymentIdentifier not set due to editor pushback timer.
Fix '!' amount expand for BIP21 without a specified payment amount.
2023-09-04 15:55:23 +02:00
Sander van Grieken
a52c715304 qml: show experimental warning before opening first lightning channel. closes #8564 2023-09-04 15:02:40 +02:00
Sander van Grieken
a740a20fc2 qml: pass the invoice/invoiceparser to payOnchain 2023-09-01 15:44:24 +02:00
Sander van Grieken
c348d4d7ce follow-up 0a804607a4, don't ask confirmation for regular onchain invoices 2023-09-01 15:08:01 +02:00
Sander van Grieken
0a804607a4 qml: properly suggest paying bolt11 invoice onchain if insufficient LN balance.
Also, if fallback address is present, don't warn on bolt11 and no ln channels.
2023-09-01 15:03:44 +02:00
ThomasV
a5da379d13 swap dialog: show on_result popup for both directions 2023-09-01 08:47:55 +02:00
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
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
b2053c68f1 make use_to_trampolines a user visible option, disable it by default 2023-08-27 11:43:17 +02:00
ThomasV
341227c3cd qt: show routing hints in ln invoice window 2023-08-27 11:08:54 +02: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
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
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
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
5a3abdde85 qml: don't apply ElListView deadzones on Linux desktop
otherwise I can't click on list items if the window is moved too far to the right :O

follow-up 583afefe33

Note: on modern Android, apps don't always run full-screen.
      You can pop them out into small windows and move them.
      Haven't tested how the deadzones work then though.
2023-08-10 15:22:36 +00:00
SomberNight
d663d92424 qml: handle importChannelBackupFailed in WalletMainView
error was not being shown when scanning/pasting channel backup from Send screen
2023-08-10 14:46:00 +00:00
SomberNight
c5493a354d qt PayToEdit: always add context menu items
fixes regression from https://github.com/spesmilo/electrum/pull/8462
2023-08-09 16:00:09 +00:00
ThomasV
40f2087ac3 Add option for support_large_channels.
max_funding_sats is a config variable and defaults to the old value.
2023-08-09 16:36:12 +02:00
SomberNight
a674f63ce3 qt channels list: add TODO
(noticed on regtest)
2023-08-03 17:21:08 +00:00
Sander van Grieken
f4f88f4294 qml: fix wizard text for keystore, wrap text 2023-07-31 11:43:15 +02:00
Sander van Grieken
583afefe33 qml: add deadzones on the edge of the screen to work around android back gesture unintended click events 2023-07-28 14:47:40 +02: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
6b52aad3c8 qml: silence some null deref errors at shutdown 2023-07-14 10:28:50 +02:00
Sander van Grieken
60e007862b qml: defer updates, fixes listitems not updating 2023-07-13 19:17:16 +02:00
Sander van Grieken
0428fc7c0a qml: add explanatory infomessage when sending capacity is significantly less than local balance.
Show message when attempting unfreeze of gossip channel in trampoline mode
2023-07-13 19:17:16 +02:00
Sander van Grieken
45944d280d qml: update channelbar when conditions change 2023-07-13 19:17:16 +02:00
Sander van Grieken
2cf4cc1978 qml: render reserved channel capacity in a darker tone, take frozen into account 2023-07-13 19:17:16 +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
Sander van Grieken
b6863b4854 qml: add LabelSync toggle 2023-07-11 12:51:37 +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
023e8ff0eb qml: remember invoice/qr type on ReceiveDialog 2023-07-10 18:10:15 +02:00