1
0
Commit Graph

14441 Commits

Author SHA1 Message Date
SomberNight
a758c99bbe kivy: add "clear all gossip" button in ln gossip dialog
One usecase is perhaps to save space if using trampoline anyway...
more importantly, if using gossip, LNGossip is heavily filtering what messages we request and get,
and e.g. can missing new NodeAnnouncements, etc,
and this is a quick-and-dirty workaround to force a fresh start.
2022-06-02 18:28:21 +02:00
SomberNight
fbc750bab1 qt.util: HelpLabel, HelpButton, InfoButton: factor out HelpMixin
based on 3ca8854007

Co-authored-by: Calin Culianu <calin.culianu@gmail.com>
2022-06-02 15:25:07 +02:00
Jonas Lundqvist
b7b53e56bc Qt PayToEdit: add option to scan QR code from screen(shot)
this ports the following commits:
448376e441
6053f6f696
2022-06-01 19:10:01 +02:00
SomberNight
9d125118da qrreader.get_qr_reader: raise instead of returning None
move MissingQrDetectionLib to core lib
2022-06-01 18:54:24 +02:00
Axel Gembe
01d20cba49 qt PayToEdit: various fixes, incl icon size/pos, field size, scrollbar
this ports https://github.com/Electron-Cash/Electron-Cash/pull/1371

including commits:
---
bab816e2c3

Buttons Editor: Make background non-transparent and change to push button

There were some issues with transparent backgrounds with QToolButton on
Linux and as there is no real reason for them to be transparent we just
make them opaque.
---
2cb698affc
Pay to editor: Fix size computations to use the proper values

Previously this did not take into account the spacing between lines nor
the margins of the control and the document. There is also a sensible
minimum height of one line now and it expands to up to 10 lines before
we show the scroll bar. When the scroll bar is active, we move the buttons
so they do not obscure the scroll bar.
---
1b7a70f4f5
Pay to editor: Increase height by one if cursor is under buttons
---
abd42d9f66
 Buttons Editor: Always center if the document is just one line high
---
33bd0b82e0
Pay to editor: Make button movement on scrollbar change reliable
---
94f8476c2e
Pay to editor: Use document lineCount instead of height
---
5bedfce392
Buttons Editor: Improve vertical centering of the buttons, needs to take into account the frame width
---
0cd0b490c4
Buttons Editor: Add transparent border which is somehow needed for correct macOS layout
2022-06-01 18:24:37 +02:00
Axel Gembe
2d1727520f qt ButtonsWidget: refactor into OverlayControlMixin; fix alignmt/hover
This ports the following:
782f213bbd
2e5af27a7c
889fcbd26a
c07b0ad616
2022-06-01 17:27:32 +02:00
Axel Gembe
798dbca880 qt ButtonsWidget: Don't pass app instance to addCopyButton
Doesn't make sense to pass the application when we can just use
QApplication.instance() instead.

from 54ccf640c5
2022-06-01 17:01:21 +02:00
SomberNight
abe3955d91 qt.util.ButtonsWidget: add custom setText arg to methods
I am planning to use this in qt.PayToEdit.
2022-05-31 16:40:22 +02:00
SomberNight
32f88ae419 util: rm a magic number 2022-05-30 21:42:52 +02:00
SomberNight
5e0df77df6 kivy: fix threading issue when scanning bip70 qr code on newer kivy
kivy 2.1 seemingly became more sensitive to threading issues.
This used to work on kivy 2.0 and older, but 2.1 is complaining.

```
I | paymentrequest | Error while contacting payment URL: https://bitpay.com/i/... -- error type: <class 'aiohttp.client_exceptions.ClientResponseError'> -- Got HTTP status code 404.
E | util | Exception in get_payment_request: TypeError('Cannot create graphics instruction outside the main Kivy thread')
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/util.py", line 1175, in wrapper
    return await func(*args, **kwargs)
  File "/home/user/wspace/electrum/electrum/util.py", line 1033, in get_payment_request
    on_pr(request)
  File "/home/user/wspace/electrum/electrum/gui/kivy/main_window.py", line 460, in on_pr
    self.show_error("invoice error:" + pr.error)
  File "/home/user/wspace/electrum/electrum/gui/kivy/main_window.py", line 1066, in show_error
    self.show_info_bubble(text=error, icon=icon, width=width,
  File "/home/user/wspace/electrum/electrum/gui/kivy/main_window.py", line 1092, in show_info_bubble
    info_bubble = self.info_bubble = Factory.InfoBubble()
  File "/usr/local/lib/python3.8/dist-packages/kivy/uix/bubble.py", line 199, in __init__
    self._arrow_layout = BoxLayout()
  File "/usr/local/lib/python3.8/dist-packages/kivy/uix/boxlayout.py", line 145, in __init__
    super(BoxLayout, self).__init__(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/kivy/uix/layout.py", line 76, in __init__
    super(Layout, self).__init__(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/kivy/uix/widget.py", line 361, in __init__
    self.canvas = Canvas(opacity=self.opacity)
  File "kivy/graphics/instructions.pyx", line 608, in kivy.graphics.instructions.Canvas.__init__
  File "kivy/graphics/instructions.pyx", line 154, in kivy.graphics.instructions.InstructionGroup.__init__
  File "kivy/graphics/instructions.pyx", line 60, in kivy.graphics.instructions.Instruction.__init__
TypeError: Cannot create graphics instruction outside the main Kivy thread
```
2022-05-30 21:19:50 +02:00
SomberNight
06687e06d8 lnpeer: forwarding: better handle if next_peer is offline 2022-05-30 16:46:31 +02:00
ThomasV
cc1b4a5c90 lnpeer: fix ping behavior.
- Do not send ping if messages have been received recently.
 - Do not send more than one ping.
 - Await pong before sending commitment_signed (per BOLT-2)
 - Lower ping time to 30s
2022-05-30 09:31:42 +02:00
ThomasV
c1c6c01e87 rebalance dialog: fix button disabling 2022-05-29 19:00:52 +02:00
ThomasV
8750936679 Rebalance dialog:
- move dialog code to own submodule and class
 - disable ok button if amount is out of bounds
 - add max button
 - add Rebalance button to channels tab
2022-05-29 18:40:45 +02:00
ThomasV
38b155c631 Qt receive widgets: factorize code 2022-05-29 13:54:38 +02:00
ThomasV
ce96d1f97b lnworker: create_routes_for_payment: try random order
without this, we keep retrying with the same trampoline when payment fails
2022-05-29 12:38:16 +02:00
ThomasV
cd54244956 lnworker: in sugest_channels_for_rebalance, delta depends on the channel
Also, safety margin can be reduced.
2022-05-29 11:58:49 +02:00
SomberNight
ae76a0daf5 windows binaries: try to prevent users from renaming exe while running
closes https://github.com/spesmilo/electrum/issues/4072
(this fix AFAICT only works on Windows, and #4072 contains some macOS reports as well,
however all recent reports are for Windows and overall most reports are for Windows,
so let's close it optimistically for now)
2022-05-29 03:26:20 +02:00
ThomasV
00183b5412 Qt: move current_request logic from main_window to requests_list 2022-05-28 17:52:07 +02:00
SomberNight
52b73880f9 requirements: pin protobuf "<4"
protobuf 4.x introduced breaking changes compared to 3.20.
To adapt, we would have to regenerate paymentrequest_pb2.py, using protoc>=3.19.0, however ubuntu does not have new enough protoc.
Also, unsure if newly generated paymentrequest_pb2.py would be supported by older versions of protobuf.
Best to just wait for things to settle.

```
electrum/__init__.py:20: in <module>
    from .wallet import Wallet
electrum/wallet.py:70: in <module>
    from . import transaction, bitcoin, coinchooser, paymentrequest, ecc, bip32
electrum/paymentrequest.py:37: in <module>
    from . import paymentrequest_pb2 as pb2
electrum/paymentrequest_pb2.py:36: in <module>
    _descriptor.FieldDescriptor(
.tox/py3/lib/python3.9/site-packages/google/protobuf/descriptor.py:560: in __new__
    _message.Message._CheckCalledFromGeneratedFile()
E   TypeError: Descriptors cannot not be created directly.
E   If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
E   If you cannot immediately regenerate your protos, some other possible workarounds are:
E    1. Downgrade the protobuf package to 3.20.x or lower.
E    2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
E
E   More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
```

ceaae1b6a3/CHANGES.txt (L47)
2022-05-27 18:38:26 +02:00
SomberNight
8e9274bde4 mac build: README: add more details about installing Xcode 2022-05-27 17:51:53 +02:00
SomberNight
ecf4e3db48 mac build: compare_dmg script: if binaries mismatch, print the diff 2022-05-27 17:48:18 +02:00
SomberNight
3e290c9d47 update release notes for 4.2.2
(from 4.2.x branch)
2022-05-27 17:33:35 +02:00
ThomasV
3ce42edbab update locale submodule 2022-05-27 12:17:41 +02:00
ThomasV
7cf495d1e0 Windows build scripts: Read codesign passphrase. Lazy check if unsigned binaries are there. 2022-05-27 11:07:32 +02:00
SomberNight
58be69afd3 commands: add "encrypt_file" arg to "password" command 2022-05-26 21:41:29 +02:00
SomberNight
d04e3c7288 bip70 paymentrequest: remove support for "file" URIs 2022-05-26 19:50:47 +02:00
SomberNight
b7a3e07db8 bump version to 4.3.0a0 2022-05-26 19:10:29 +02:00
SomberNight
189390fb2d qt new_channel_dialog: use lnutil.MIN_FUNDING_SAT instead of ad-hoc val 2022-05-26 18:08:15 +02:00
SomberNight
ad42de03ac qt new_channel_dialog: fix regression: oepn chan with "max" amt
```
E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\channels_list.py", line 377, in new_channel_with_warning
	self.new_channel_dialog()
  File "...\electrum\electrum\gui\qt\channels_list.py", line 399, in new_channel_dialog
	return d.run()
  File "...\electrum\electrum\gui\qt\new_channel_dialog.py", line 133, in run
	if self.min_amount_sat and funding_sat < self.min_amount_sat:
TypeError: '<' not supported between instances of 'str' and 'int'
```
2022-05-26 18:05:18 +02:00
ThomasV
30a98578c8 Refactor: move calls to lnworker methods out of the tx creation functions
(follow-up f0237e46be)
2022-05-26 15:04:43 +02:00
ThomasV
f0237e46be lnsweep: do not redeem offered HTLCs unless payment was received in full 2022-05-26 14:28:25 +02:00
ThomasV
672326bd12 lnwatcher: a bit less verbose 2022-05-26 12:00:11 +02:00
ThomasV
035c877813 channels_list: do not add extra whitespaces when displaying amounts in HTLCs 2022-05-26 09:04:46 +02:00
SomberNight
79578d6c18 lnchannel: fix diagnostic_name, for better log lines
Previously nothing re channel id was logged, as "diagnostic_name" is only evaluated once,
and it ran before channel_id was set.
2022-05-25 23:51:11 +02:00
ThomasV
58194ce78b Merge pull request #7830 from SomberNight/202205_lnpeer_reestablish_channel
lnpeer.reestablish_chan: enforce order of replaying commitsig/revack
2022-05-25 19:54:51 +02:00
SomberNight
ef4477a930 lnpeer.reestablish_chan: enforce order of replaying commitsig/revack
When replaying messages during channel-reestablishment,
previously we first resent all update messages, along with potential commitment_signed messages,
and then we potentially resent a single revoke_and_ack.

This can result in incorrect behaviour in case both a commitment_signed and a revoke_and_ack needs to be resent.
When replaying messages, the relative order of commitment_signed and revoke_and_messages needs to be preserved.
(the order of updates (htlc/fee) in relation to the revack messages does not matter)

implements https://github.com/lightning/bolts/pull/810

The logic here is somewhat based on what c-lightning does:
01e5f1886e/channeld/channeld.c (L3059)
2022-05-25 19:44:44 +02:00
ThomasV
56659c550e lnwatcher: fix another broadcast-too-early error 2022-05-25 12:45:53 +02:00
ThomasV
e99a5a7703 fix lnwatcher broadcast logic, follow-up b9f01a86fe 2022-05-25 12:34:52 +02:00
ThomasV
adbabacc12 Stabilize size of receive_tabs widgets
- use SetMinimumSize instead of sizeHint
   (partially reverts 28f794b63b)
 - to deal with small window sizes, set MinimumHeight of the
   parent TabWidget (with a few extra pixels for margins)
 - add an extra layout around address_help_text, so that it has
   margins (margins were removed in 28f794b63b)
2022-05-25 10:17:39 +02:00
ThomasV
7abc7c720f receive_tabs: add tooltip to inner widgets 2022-05-24 19:30:51 +02:00
ThomasV
b9f01a86fe lnwatcher: check that parent transaction is confirmed in CSV test 2022-05-24 19:13:10 +02:00
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