1
0
Commit Graph

14399 Commits

Author SHA1 Message Date
ThomasV
5bb99ddfaf submarine_swaps: fix order of operations in get_send_amount 2022-05-24 18:51:09 +02:00
SomberNight
2362d6d010 follow-up "remove email plugin"
follow-up c67c4e95dc
2022-05-24 18:33:19 +02:00
SomberNight
28f794b63b Qt receive tab: better receive_tabs widget size for small windows
Previously the receive_tabs widget was allowed to be much smaller
than its inner main widget (e.g. truncating visible QR code).
A bit hackish to overwrite/monkeypatch sizeHint,
but I've tried a few approaches and this seems to work best.
2022-05-24 18:15:12 +02:00
ThomasV
2e120d74b8 Qt: add name to coroutines_scheduled 2022-05-24 13:39:06 +02:00
ThomasV
feb10bc67b remove unneeded parameter (follow-up e392197ab9) 2022-05-24 13:33:16 +02:00
ThomasV
3e0d7ff549 improve channels_list menus (minor) 2022-05-24 12:48:19 +02:00
ThomasV
f14c420c30 Qt: display number of tasks (window._coroutines_scheduled) in toolbar.
Disable rebalance/swap suggestions attached to requests/invoices if there is an ongoing task.
Note: This assumes that all tasks are lightning payments, which is true for the moment.
2022-05-24 12:18:32 +02:00
ThomasV
c67c4e95dc remove email plugin 2022-05-24 11:48:14 +02:00
ThomasV
bb0f4b5a65 Merge pull request #7828 from JeremyRand/is-none-bitcoin
Fix "== None" linter fails
2022-05-24 06:41:22 +02:00
Jeremy Rand
1aa444e0f8 Fix "== None" linter fails
Credit to Zoltan Konder for pointing me to this issue.
2022-05-24 02:39:11 +00:00
SomberNight
cac4b6f92c email plugin: SSL was using insecure defaults 2022-05-23 19:04:51 +02:00
SomberNight
7e77a7e1cc email plugin: (trivial) adapt to Invoices refactor 2022-05-23 18:53:19 +02:00
SomberNight
98feff07ad threading.Thread: fix some DeprecationWarnings
"DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead"
2022-05-23 17:52:39 +02:00
ThomasV
0431cd825e Allow the QR code in the receive tab to be variable size 2022-05-23 13:17:25 +02:00
ThomasV
2a31f80d09 QRCodeWidget: add margin of 1 block, remove fixedSize parameter 2022-05-23 11:38:09 +02:00
ThomasV
3b44646bd1 QRCodeWidget: show warning in GUI 2022-05-23 10:11:35 +02:00
ThomasV
155b3703ac QR window: fix tab order 2022-05-23 09:49:17 +02:00
ThomasV
50a272ec8f do not propose rebalance between channels to the same trampoline 2022-05-23 09:31:38 +02:00
ThomasV
53b4389e05 Qt: set fixed size for reveive help widgets 2022-05-23 09:20:14 +02:00
ThomasV
4cd2807563 Qt: rephrase messages, propose 'pay onchain' as the last option 2022-05-23 09:03:45 +02:00
ThomasV
5d659cda0e improve channel_funding_sat suggestion. add min_amount parameter to new_channel_dialog 2022-05-22 17:18:28 +02:00
ThomasV
e43983e854 Qt: update current request when update_tabs is called 2022-05-22 13:32:24 +02:00
ThomasV
23230c3c10 receive widget: minor improvements, more help text 2022-05-22 11:40:01 +02:00
ThomasV
0656e6d44e suggest_rebalance: special case for MPP heuristics 2022-05-22 09:22:16 +02:00
ThomasV
53151244e2 LNWorker: Add suggest_rebalance methods for sending and receiving.
These methods return a list of channels that can be rebalanced,
in order to receive or send a given amount.

Also add 'channels' parameter to submarine swaps.
Previously, swaps were not considering which channel to use.

When we do not have liquidity to pay an invoice:
 - add 'rebalance' option in order to pay an invoice
 - use the suggested channel in the 'swap' option

When we do not have the liquidity to receive an invoice:
 - add 'Rebalance' and 'Swap' buttons to the receive tab
2022-05-21 20:25:44 +02:00
SomberNight
4915db52b9 interface: fix DeprecationWarnings re SSLContext
```
...\electrum\electrum\interface.py:585: DeprecationWarning: ssl.SSLContext() without protocol argument is deprecated.
  sslc = ssl.SSLContext()
...\electrum\electrum\interface.py:585: DeprecationWarning: ssl.PROTOCOL_TLS is deprecated
  sslc = ssl.SSLContext()
```
2022-05-21 18:43:32 +02:00
ThomasV
917f256e33 remove scheduled invoices: bad UX. better expect the user to retry later. 2022-05-21 12:24:26 +02:00
ThomasV
ac8a29efc2 kivy: minor fix 2022-05-21 12:23:01 +02:00
ThomasV
bc9cc51800 Add 'channels' parameter to create invoice and pay.
Add rebalance dialog to GUI
2022-05-21 11:35:44 +02:00
SomberNight
8ed52d4225 Qt change_password_dialog: fix deadlock in hww case if device unplugged
fixes https://github.com/spesmilo/electrum/pull/7819
2022-05-20 20:07:55 +02:00
SomberNight
a0b7782e6d Qt addr/utxo lists: in dark theme, fix item bgcolor (was pure black)
regression from e362d1aac4
2022-05-20 18:26:30 +02:00
SomberNight
57ec9612cb Qt ConfirmTxDialog: make sure dialog is deleted when closed
Same for BlockingWaitingDialog.

related: https://github.com/spesmilo/electrum/issues/3956#issuecomment-1017593613
Note that this change does not solve the "dialog sometimes does not get drawn properly" issue,
just the "dialog sometimes does not get closed properly" issue.

closes: https://github.com/spesmilo/electrum/issues/7816
2022-05-20 18:05:16 +02:00
ghost43
4e11116eab Merge pull request #7633 from JamieDriver/blockstream_jade_support
Add support for the Blockstream Jade hww
2022-05-20 15:14:03 +00:00
Jamie C. Driver
15f108aaa5 Add support for the Blockstream Jade hww 2022-05-20 16:03:46 +01:00
ThomasV
dd3481c9e1 Merge pull request #7821 from SomberNight/202205_lnworker_num_sats_can_receive
lnworker: rework num_sats_can_receive and routing_hints_for_invoice
2022-05-20 10:01:59 +02:00
SomberNight
2ec9e869b3 invoice.get_amount_sat: handle None in more places
I believe lightning requests created before https://github.com/spesmilo/electrum/pull/7730
can have an amount of None - ones created after have amount 0 instead.
We could do a wallet db upgrade potentially.
Regardless, the type hint is `get_amount_sat(self) -> Union[int, str, None]`,
so None should be handled. (well, arguably "!" should be handled too...)

```
E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\request_list.py", line 101, in item_changed
    self.parent.show_receive_request(req)
  File "...\electrum\electrum\gui\qt\main_window.py", line 1279, in show_receive_request
    URI = req.get_bip21_URI(lightning=bip21_lightning)
  File "...\electrum\electrum\invoices.py", line 164, in get_bip21_URI
    amount = int(self.get_amount_sat())
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
```

```
E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\request_list.py", line 101, in item_changed
    self.parent.show_receive_request(req)
  File "...\electrum\electrum\gui\qt\main_window.py", line 1281, in show_receive_request
    can_receive_lightning = self.wallet.lnworker and req.get_amount_sat() <= self.wallet.lnworker.num_sats_can_receive()
TypeError: '<=' not supported between instances of 'NoneType' and 'decimal.Decimal'
```
2022-05-19 19:43:07 +02:00
SomberNight
3eddc17e21 util.parse_URI: fix typo 2022-05-19 19:30:11 +02:00
SomberNight
dd5cb2a5c1 lnworker: rework num_sats_can_receive and routing_hints_for_invoice
follow-up https://github.com/spesmilo/electrum/pull/7818

- note it matters whether a sender pays us end-to-end-trampoline or just via legacy
  - consider: Alice has 0.1 BTC recv cap in chan1 and 1 BTC recv cap in chan2, both with border-node T1
    - if sender is paying e2e trampoline, it can realistically pay even ~1.1 BTC, as T1 can resplit the HTLCs
    - if sender is paying legacy, it will have a hard time trying to pay more than 1 BTC, in practice
      - although note if T1 has implemented non-strict-forwarding (see BOLT-04), achieving 1 BTC is easy,
        as T1 can redirect HTLCs (but cannot split them, in this case)
  - to make num_sats_can_receive realistic, it assumes the legacy case
- To calc num_sats_can_receive, we sort our channels in decreasing order of receive-capacities, iterate over them
  and calculate a running sum - we stop adding channels when the next chan's recv cap is small compared to
  the running total.
- When putting routing hints in an invoice, we do the same, with the added condition that we keep adding channels
  if their recv cap is larger than the invoice amount.
  - consider: Alice has 0.1 BTC recv cap in chan1 with Bob, and 1 BTC recv cap in chan2 with Carol
    - if Alice wants to recv 100 sats, it is useful to add hints for both channels into the invoice, for redundancy
    - if Alice wants to recv 0.9 BTC, it is questionable whether adding the smaller chan is useful - the code here won't add it
2022-05-19 18:28:04 +02:00
ThomasV
476c0cbf70 swap dialog: disable amount edits and buttons if an amount is passed 2022-05-19 15:37:11 +02:00
ThomasV
3c47060cb2 receive_tab: better help text if lightning peers are disconnected 2022-05-19 15:08:44 +02:00
ThomasV
cf01a792df Qt: run swap_manager.get_pairs() before opening SwapDialog 2022-05-19 11:42:02 +02:00
ThomasV
232e38e27d Merge pull request #7818 from spesmilo/filter_nodes_for_receiving
Filter nodes for receiving:
2022-05-18 18:20:22 +02:00
ThomasV
f90a08bbe2 Filter nodes for receiving:
- increase MPP_RECEIVE_CUTOFF from 5 to 20 percent
 - filter channels by node_id, not channel_id
 - make num_sats_can_receive consistent with routing hints
2022-05-18 18:11:40 +02:00
ThomasV
0a6495c490 lnworker: if trampoline is active, make num_sats_can_send
return the max value allowed for legacy payments.
(that is, do not assume we can do MPP involving two trampolines)
This reverts fb6047ec46

Reason: num_sats_can_send may be used to decide the amount
we put in a new channel.
2022-05-18 09:48:22 +02:00
ThomasV
cc3be95fcc Receive tab: toggle QR code by clicking on receive widget 2022-05-17 16:14:25 +02:00
SomberNight
d7678e14b5 interface: bypass proxy for servers on localhost
closes https://github.com/spesmilo/electrum/issues/3126
closes https://github.com/spesmilo/electrum/issues/7256

I am unsure if this would be safe to do for the more general "server running on private ip" case,
so this is restricted to localhost only atm.
2022-05-16 22:24:07 +02:00
SomberNight
3cc6c0dd2d qt: start using ButtonsWidget's add_qr_input_button/add_qr_show_button 2022-05-14 18:56:11 +02:00
SomberNight
5398b9d9c9 qr qrtextedit: move functionality up to ButtonsWidget 2022-05-14 18:56:07 +02:00
SomberNight
6bb057b548 qt refactor qrtextedit.py, create "ScanShowQRTextEdit" 2022-05-14 18:56:01 +02:00
ghost43
849ad5f5f9 Merge pull request #7812 from baam25simo/show_signature_with_qr
Show message signature as QR code
2022-05-14 16:42:56 +00:00