1
0
Commit Graph

14369 Commits

Author SHA1 Message Date
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
baam25simo
33208bfdc3 Qt: sign_message: added button to show signature in QR code. 2022-05-14 18:37:16 +02:00
SomberNight
2b7cf31308 qt: don't show empty BalanceDialog 2022-05-14 18:32:52 +02:00
SomberNight
2e260bd602 qt PayToEdit: rm redundant code
This is already handled by `self.textChanged.connect(self.check_text)` in __init__.
2022-05-14 01:28:37 +02:00
SomberNight
b3d8b4603f interface: trigger fewer 'blockchain_updated' notifications
The Qt GUI refreshes all tabs on 'blockchain_updated', which is expensive for very large wallets.
Previously, on every new block, the GUI would get one notification for each connected interface,
now only the fastest interface triggers it.

(was testing with a wallet where refreshing all tabs takes 15 seconds, and 10*15 seconds is
even more annoying...)
2022-05-14 01:20:22 +02:00
SomberNight
d128391ea0 daemon: add command-line args for RPC user/pass/host/port
based on c50d8d754c
2022-05-13 16:48:50 +02:00
SomberNight
641c3e23a4 daemon: default rpc socktype to "tcp" if rpcport is set
Having `rpcport` set already indicates the user does not want unix sockets,
we just default `rpchost` to "localhost".

related https://github.com/spesmilo/electrum/issues/7811
2022-05-13 16:19:28 +02:00
ThomasV
c945f2292e (minor) Fix receive_qr_visible.
Rename method: toggle_qr_window
2022-05-12 12:40:58 +02:00
SomberNight
cbc69742b9 wallet_db: clarify hww types in old upgrades
There is no point in adding new hww types to these lists every time support for a new hww is added.
These upgrades got released in 2.7.0 and any hw types added after are unrelated.

reverted to just-after last relevant change:
c820423b00
2022-05-11 19:50:57 +02:00
SomberNight
7f876e46fb hw plugins: (follow-up) rm some more dead code
follow-up 30623c3529
2022-05-11 19:41:25 +02:00
SomberNight
6c50d3b0a3 hw plugins: (cleanup) rm no-op clear_client argument from keystore.give_error
The keystore does not have a "client" field.
One is supposed to use the "get_client" method instead (the generic API is `plugin.get_client(keystore)`)
Remnants of old code.
2022-05-11 19:30:14 +02:00
SomberNight
aab8e664ed hw plugins: (cleanup) Plugin objects should not have a Client field
Clients are per-connected-device, plugins are ~singletons.
These were mostly remnants of old code.
2022-05-11 19:16:18 +02:00
SomberNight
30623c3529 hw plugins: (cleanup) Plugin objects should not have a Handler field
Handlers are per-client (connected device), plugins are ~singletons.
These were mostly remnants of old code.
2022-05-11 19:13:00 +02:00
SomberNight
1fedb23946 appimage: update package (libdbus-1-3) in dockerfile 2022-05-11 18:08:36 +02:00
SomberNight
d499dde811 addr_sync: get_balance change cache_key to have delimiters
re https://github.com/spesmilo/electrum/pull/7807/files#r870482609
2022-05-11 17:54:33 +02:00
ThomasV
0d66409fbd follow-up prev commit 2022-05-11 09:43:10 +02:00
ThomasV
a8fc0a8f81 Qt: move open_channel_dialog code in separate module
(no functional change in this commit)
2022-05-11 09:39:45 +02:00
ThomasV
1d498eeefc Change the semantics of get_balance:
It does not make sense to count change outputs in our unconfirmed balance,
because our balance will not be negatively affected if the transaction does
not get confirmed.

It is also incorrect to add signed values of get_addr_balance in order to compute
the balance over a domain. For example, this leads to incoming and outgoing
transactions cancelling out in our total unconfirmed balance.

This commit looks at the coins that are spent by a transaction. If those
coins belong to us and are confirmed, we do not count the transaction outputs
in our unconfirmed balance.

As a result, get_balance always returns positive values for unconfirmed balance.
2022-05-11 08:50:09 +02:00
ThomasV
1274ec7655 Qt balance piechart: show lightning funds that are frozen 2022-05-10 20:07:30 +02:00
SomberNight
9599254d43 hw: rm dead code from Hardware_KeyStore subclasses
- force_watching_only is long since unused
- comment was just duplicated from the base class
2022-05-09 20:09:10 +02:00
SomberNight
3535eef8f8 (trivial) qt locktimeedit: fix a DeprecationWarning
/home/user/wspace/electrum/electrum/gui/qt/locktimeedit.py:145: DeprecationWarning: an integer is required (got type Alignment).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  painter.drawText(textRect, Qt.AlignRight | Qt.AlignVCenter, "height")
2022-05-09 19:50:38 +02:00
SomberNight
9e0a0af81a bip39_recovery: also scan change addresses
fixes https://github.com/spesmilo/electrum/issues/7804
2022-05-07 18:52:33 +02:00
ThomasV
dd43ccfda9 get_history: minor simplification 2022-05-07 18:46:28 +02:00
SomberNight
2e99ac9a94 qt preferences: fix "allow_instant_swaps" checkbox 2022-05-07 16:20:16 +02:00
ThomasV
2022b2e341 Merge pull request #7797 from SomberNight/202205_distutils
vendor a part of `distutils`, to be removed from stdlib in py3.12
2022-05-07 09:45:29 +02:00
SomberNight
37ba7277ae qt main_window: fix visual artifact when opening (re invoice lists)
InvoiceList.update() calls hide_if_empty(), which calls setVisible().
setVisible(True) should not be called before the widget is properly parented and put into a layout,
as that results in a blank window flashing up (appearing and disappearing) briefly.
2022-05-06 20:02:53 +02:00
SomberNight
a15ed939b7 setup.py: use relative paths in data_files
fixes https://github.com/spesmilo/electrum/issues/7787
fixes https://github.com/spesmilo/electrum/issues/5227
closes https://github.com/spesmilo/electrum/pull/5553
2022-05-06 16:32:06 +02:00
ThomasV
b0a6f895b2 Qt: add help text to receive address widget 2022-05-06 11:35:52 +02:00
ThomasV
ad70659a66 qr code widget: set margin to zero, print warning if cannot draw 2022-05-06 11:33:10 +02:00
gruve-p
eb66ed8e4b appimage: update libssl-dev libssl1.0.0 openssl libsqlite3-dev (#7798) 2022-05-05 14:57:35 +00:00
SomberNight
d5f987c9e9 hw keepkey: workaround protobuf weirdness
this adds a hackish workaround for https://github.com/spesmilo/electrum/issues/7779
2022-05-04 20:41:49 +02:00