1
0
Commit Graph

14528 Commits

Author SHA1 Message Date
yanmaani
04b81d6b82 contrib: add generate_payreqpb2.sh script 2022-07-04 12:00:00 +00:00
yanmaani
2da1859110 build: support OMIT_UNCLEAN_FILES in sdist/build.sh 2022-07-04 12:00:00 +00:00
yanmaani
a7e17ae4ee build: add OMIT_UNCLEAN_FILES option to make_sdist.sh 2022-07-04 12:00:00 +00:00
yanmaani
45b8f11c68 build: refactor out locale generation into build_locale.sh 2022-07-04 12:00:00 +00:00
SomberNight
0fca35fa40 android build: increase buildozer log level (except on cirrus ci) 2022-07-01 18:52:30 +02:00
SomberNight
bb0db0e3c0 build: incl "frozenlist" dep as pure-python, without C stuff
While attempting to reproducibly build the qml android apk, one of the differences
was due to the "frozenlist" dependency (pulled in by aiohttp) - the compiled C parts
were not deterministic. By setting this env var, we can opt-out [0] of all the C
accelerated parts and just use the pure-python implementation. We are already doing
the same for other aiohttp-related packages anyway.

[0]: c2794cac12/setup.py (L7)
2022-07-01 18:35:42 +02:00
SomberNight
aea16f1322 qt main_window: (trivial) clean-up weird types passed to qt calls 2022-07-01 16:23:06 +02:00
SomberNight
133c0f71c4 qt ReceiveTab: (trivial) rename clear_receive_tab to do_clear 2022-07-01 16:21:56 +02:00
SomberNight
5b29e6d4f5 qt: (refactor) split "receive tab" out from main_window.py 2022-07-01 16:03:28 +02:00
ThomasV
798df1fd53 Merge pull request #7874 from SomberNight/202206_qt_split_sendtab
qt: (refactor) split "send tab" out from main_window.py
2022-07-01 12:57:34 +02:00
Sander van Grieken
8d57129ad6 p4a: update commit ref to head of qt5-wip (fixes cpu count used for build) 2022-06-30 21:23:41 +02:00
SomberNight
2d68350900 qt: (refactor) split "send tab" out from main_window.py 2022-06-30 20:29:08 +02:00
ghost43
05226437bf Merge pull request #7839 from SomberNight/202202_lnurl_2
add lnurl-pay (`LUD-06`) support
2022-06-30 16:30:21 +00:00
SomberNight
0509109d61 qt.util.MyTreeView: handle find_row_by_key returning None
fixes https://github.com/spesmilo/electrum/issues/7780
fixes https://github.com/spesmilo/electrum/issues/7815

Re FIXME in main_window.py, in particular, adb might call `add_transaction` on the same tx multiple times.
In `wallet.on_event_adb_added_tx`, maybe we should propagate `notify_GUI` to `wallet._update_request_statuses_touched_by_tx`.

The issue being fixed here (above TARS reports) can be triggered in multiple ways, e.g.:
- have an already paid receive request, and receive a payment to the same address again
- have an already paid receive request, and *spend from* that address (in which case the history of the address will change, and address_synchronizer will call add_transaction again on the old tx that satisfied the old receive request)
2022-06-29 19:11:05 +02:00
SomberNight
1b6706bed6 replace some erroneous usages of IntFlag with IntEnum 2022-06-29 18:07:03 +02:00
SomberNight
9f1da8422b qt LightningTxDialog: (fix regression) show fee for ln payments
follow-up e1d34300e5
2022-06-29 18:02:55 +02:00
SomberNight
1f6bd9a694 kivy: fix threading issue for window.show_error
related: 5e0df77df6

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.

```
E | lnworker.LNWallet.[default_wallet] | Exception in pay_invoice: TypeError('Cannot create graphics instruction outside the main Kivy thread')
Traceback (most recent call last):
  File "...\electrum\util.py", line 1184, in wrapper
    return await func(*args, **kwargs)
  File "...\electrum\lnworker.py", line 1178, in pay_invoice
    util.trigger_callback('payment_succeeded', self.wallet, key)
  File "...\electrum\util.py", line 1633, in trigger_callback
    callback(*args)
  File "...\electrum\gui\kivy\main_window.py", line 309, in on_event_payment_succeeded
    self.show_info(_('Payment succeeded') + '\n\n' + description)
  File "...\electrum\gui\kivy\main_window.py", line 1105, in show_info
    self.show_error(error, icon=f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/important',
  File "...\electrum\gui\kivy\main_window.py", line 1097, in show_error
    self.show_info_bubble(text=error, icon=icon, width=width,
  File "...\electrum\gui\kivy\main_window.py", line 1123, in show_info_bubble
    info_bubble = self.info_bubble = Factory.InfoBubble()
  File "...\Python310\site-packages\kivy\uix\bubble.py", line 199, in __init__
    self._arrow_layout = BoxLayout()
  File "...\Python310\site-packages\kivy\uix\boxlayout.py", line 145, in __init__
    super(BoxLayout, self).__init__(**kwargs)
  File "...\Python310\site-packages\kivy\uix\layout.py", line 76, in __init__
    super(Layout, self).__init__(**kwargs)
  File "...\Python310\site-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
E | gui.kivy.uix.dialogs.crash_reporter.ExceptionHook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\gui\kivy\uix\screens.py", line 419, in pay_thread
    fut.result()
  File "...\Python310\lib\concurrent\futures\_base.py", line 446, in result
    return self.__get_result()
  File "...\Python310\lib\concurrent\futures\_base.py", line 391, in __get_result
    raise self._exception
  File "...\electrum\util.py", line 1184, in wrapper
    return await func(*args, **kwargs)
  File "...\electrum\lnworker.py", line 1178, in pay_invoice
    util.trigger_callback('payment_succeeded', self.wallet, key)
  File "...\electrum\util.py", line 1633, in trigger_callback
    callback(*args)
  File "...\electrum\gui\kivy\main_window.py", line 309, in on_event_payment_succeeded
    self.show_info(_('Payment succeeded') + '\n\n' + description)
  File "...\electrum\gui\kivy\main_window.py", line 1105, in show_info
    self.show_error(error, icon=f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/important',
  File "...\electrum\gui\kivy\main_window.py", line 1097, in show_error
    self.show_info_bubble(text=error, icon=icon, width=width,
  File "...\electrum\gui\kivy\main_window.py", line 1123, in show_info_bubble
    info_bubble = self.info_bubble = Factory.InfoBubble()
  File "...\Python310\site-packages\kivy\uix\bubble.py", line 199, in __init__
    self._arrow_layout = BoxLayout()
  File "...\Python310\site-packages\kivy\uix\boxlayout.py", line 145, in __init__
    super(BoxLayout, self).__init__(**kwargs)
  File "...\Python310\site-packages\kivy\uix\layout.py", line 76, in __init__
    super(Layout, self).__init__(**kwargs)
  File "...\Python310\site-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

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "...\electrum\util.py", line 1128, in run_with_except_hook
    run_original(*args2, **kwargs2)
  File "...\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "...\electrum\gui\kivy\uix\screens.py", line 421, in pay_thread
    self.app.show_error(repr(e))
  File "...\electrum\gui\kivy\main_window.py", line 1097, in show_error
    self.show_info_bubble(text=error, icon=icon, width=width,
  File "...\electrum\gui\kivy\main_window.py", line 1123, in show_info_bubble
    info_bubble = self.info_bubble = Factory.InfoBubble()
  File "...\Python310\site-packages\kivy\uix\bubble.py", line 199, in __init__
    self._arrow_layout = BoxLayout()
  File "...\Python310\site-packages\kivy\uix\boxlayout.py", line 145, in __init__
    super(BoxLayout, self).__init__(**kwargs)
  File "...\Python310\site-packages\kivy\uix\layout.py", line 76, in __init__
    super(Layout, self).__init__(**kwargs)
  File "...\Python310\site-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
 Exception in thread Thread-2 (pay_thread):
 Traceback (most recent call last):
   File "...\electrum\gui\kivy\uix\screens.py", line 419, in pay_thread
     fut.result()
   File "...\Python310\lib\concurrent\futures\_base.py", line 446, in result
     return self.__get_result()
   File "...\Python310\lib\concurrent\futures\_base.py", line 391, in __get_result
     raise self._exception
   File "...\electrum\util.py", line 1184, in wrapper
     return await func(*args, **kwargs)
   File "...\electrum\lnworker.py", line 1178, in pay_invoice
     util.trigger_callback('payment_succeeded', self.wallet, key)
   File "...\electrum\util.py", line 1633, in trigger_callback
     callback(*args)
   File "...\electrum\gui\kivy\main_window.py", line 309, in on_event_payment_succeeded
     self.show_info(_('Payment succeeded') + '\n\n' + description)
   File "...\electrum\gui\kivy\main_window.py", line 1105, in show_info
     self.show_error(error, icon=f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/important',
   File "...\electrum\gui\kivy\main_window.py", line 1097, in show_error
     self.show_info_bubble(text=error, icon=icon, width=width,
   File "...\electrum\gui\kivy\main_window.py", line 1123, in show_info_bubble
     info_bubble = self.info_bubble = Factory.InfoBubble()
   File "...\Python310\site-packages\kivy\uix\bubble.py", line 199, in __init__
     self._arrow_layout = BoxLayout()
   File "...\Python310\site-packages\kivy\uix\boxlayout.py", line 145, in __init__
     super(BoxLayout, self).__init__(**kwargs)
   File "...\Python310\site-packages\kivy\uix\layout.py", line 76, in __init__
     super(Layout, self).__init__(**kwargs)
   File "...\Python310\site-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

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "...\electrum\util.py", line 1128, in run_with_except_hook
     run_original(*args2, **kwargs2)
   File "...\Python310\lib\threading.py", line 946, in run
     self._target(*self._args, **self._kwargs)
   File "...\electrum\gui\kivy\uix\screens.py", line 421, in pay_thread
     self.app.show_error(repr(e))
   File "...\electrum\gui\kivy\main_window.py", line 1097, in show_error
     self.show_info_bubble(text=error, icon=icon, width=width,
   File "...\electrum\gui\kivy\main_window.py", line 1123, in show_info_bubble
     info_bubble = self.info_bubble = Factory.InfoBubble()
   File "...\Python310\site-packages\kivy\uix\bubble.py", line 199, in __init__
     self._arrow_layout = BoxLayout()
   File "...\Python310\site-packages\kivy\uix\boxlayout.py", line 145, in __init__
     super(BoxLayout, self).__init__(**kwargs)
   File "...\Python310\site-packages\kivy\uix\layout.py", line 76, in __init__
     super(Layout, self).__init__(**kwargs)
   File "...\Python310\site-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

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "...\Python310\lib\threading.py", line 1009, in _bootstrap_inner
     self.run()
   File "...\electrum\util.py", line 1130, in run_with_except_hook
     sys.excepthook(*sys.exc_info())
   File "...\electrum\gui\kivy\uix\dialogs\crash_reporter.py", line 188, in <lambda>
     sys.excepthook = lambda exctype, value, tb: self.handle_exception(value)
   File "...\electrum\gui\kivy\uix\dialogs\crash_reporter.py", line 199, in handle_exception
     e = CrashReporter(self.main_window, *exc_info)
   File "...\electrum\gui\kivy\uix\dialogs\crash_reporter.py", line 100, in __init__
     Factory.Popup.__init__(self)
   File "...\Python310\site-packages\kivy\uix\modalview.py", line 195, in __init__
     super(ModalView, self).__init__(**kwargs)
   File "...\Python310\site-packages\kivy\uix\anchorlayout.py", line 68, in __init__
     super(AnchorLayout, self).__init__(**kwargs)
   File "...\Python310\site-packages\kivy\uix\layout.py", line 76, in __init__
     super(Layout, self).__init__(**kwargs)
   File "...\Python310\site-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-06-29 17:47:24 +02:00
SomberNight
ed1567e841 lnurl: make requests async, don't block Qt GUI, rm LUD-16 support
- in lnurl.py, make request methods async
- in Qt GUI, lnurl network requests no longer block the GUI thread
  - but they still do in the kivy GUI
- "lightning address" (LUD-16) support is removed for now as the
  email addresses are indistinguishable from openalias email addresses
  (both protocols should have added and enforced a prefix, or similar,
   to remove this kind of ambiguity -- now we would need to make a
   network request just to identify what kind of ID we were given)
2022-06-29 16:56:04 +02:00
SomberNight
df974c2384 qt paytoedit: evaluate text on textChanged(), but no network requests
- add param to _check_text to toggle if network requests are allowed ("full check")
- every 0.5 sec, if the textedit has no focus, do full check
- on textChanged()
  - detect if user copy-pasted by comparing current text against clipboard contents,
    if so, do full check
  - otherwise, do partial check
- on clicking ButtonsWidget btns (scan qr, paste, read file), do full check
2022-06-29 16:18:30 +02:00
SomberNight
a2d66ac90c kivy: rm code dupe between app.on_qr and send_screen.do_paste 2022-06-29 16:18:27 +02:00
SomberNight
649cad0122 lnurl: clean-up 2022-06-29 16:18:23 +02:00
SomberNight
82e33984ad lnurl for kivy: I need this to buy beers 2022-06-29 16:18:19 +02:00
bitromortac
fe2fbbd9b1 add lnurl-pay and lightning address support
* bundles all payment identifiers into handle_payment_identifier
* adds lnurl decoding
* adds lightning address decoding
2022-06-29 16:18:15 +02:00
SomberNight
2511d8118c lnworker.get_lightning_history(&get_payment_value): rm failing assert
follow-up e1d34300e5
follow-up dc15d59fcf

```
Traceback (most recent call last):
  File ".../electrum/gui/qt/main_window.py", line 910, in timer_actions
    self.update_wallet()
  File ".../electrum/gui/qt/main_window.py", line 1068, in update_wallet
    self.update_tabs()
  File ".../electrum/gui/qt/main_window.py", line 1075, in update_tabs
    self.history_model.refresh('update_tabs')
  File ".../electrum/util.py", line 439, in <lambda>
    return lambda *args, **kw_args: do_profile(args, kw_args)
  File ".../electrum/util.py", line 435, in do_profile
    o = func(*args, **kw_args)
  File ".../electrum/gui/qt/history_list.py", line 275, in refresh
    transactions = wallet.get_full_history(
  File ".../electrum/util.py", line 439, in <lambda>
    return lambda *args, **kw_args: do_profile(args, kw_args)
  File ".../electrum/util.py", line 435, in do_profile
    o = func(*args, **kw_args)
  File ".../electrum/wallet.py", line 1109, in get_full_history
    lightning_history = self.lnworker.get_lightning_history() if self.lnworker and include_lightning else {}
  File ".../electrum/lnworker.py", line 839, in get_lightning_history
    assert direction == PaymentDirection.FORWARDING
AssertionError
```
2022-06-29 16:12:47 +02:00
ThomasV
dc15d59fcf get_payment_value: rm failing assert 2022-06-29 13:33:04 +02:00
SomberNight
c1d34243a1 lnpeer: (trivial) better log message 2022-06-28 20:34:47 +02:00
SomberNight
4a791f9285 qt.completion_text_edit: fix logic bug re shift/ctrl 2022-06-28 19:51:26 +02:00
SomberNight
3db79210b5 network.run_from_another_thread: add type hint 2022-06-28 18:55:51 +02:00
SomberNight
5b0aad5084 network: rename _send_http_on_proxy and make it part of public API 2022-06-28 18:51:21 +02:00
SomberNight
81880e8538 EventListener: key global dict by modulepath+clsname instead of clsname
follow-up fe74e4b9c9

Just for sanity -- there could be a collision of class names (defined in separate modules).
```
>>> wallet.is_up_to_date.__qualname__
'Abstract_Wallet.is_up_to_date'
>>> wallet.is_up_to_date.__module__
'electrum.wallet'
```
2022-06-27 17:23:08 +02:00
gruve-p
29ab90e1b1 appimage: update libssl-dev libssl1.1 openssl (#7869) 2022-06-24 05:05:09 +00:00
ThomasV
fe74e4b9c9 EventListener: pre-register event listeners in the decorator,
and use that registration in the iterator.

That way, we do not invoke getattr on arbitrary methods, which
could trigger unwanted code execution (for example, if a method
is decorated with @property, getattr will execute its code).
2022-06-23 09:11:16 +02:00
SomberNight
c09903be68 daemon.PayServer.create_request: mark as broken...
looks like it's been broken for a long time.
- self.root ??
- lnworker.add_request API change
2022-06-22 02:46:22 +02:00
SomberNight
cafd5c4af0 lnworker.add_request: force keyword args
and change type-hint to reflect that fallback_address can be None
2022-06-22 02:26:54 +02:00
SomberNight
be322f7ea7 qt dialogs: disconnect signals and unregister callbacks in closeEvent 2022-06-22 02:13:19 +02:00
ghost43
c3093ded21 Merge pull request #7858 from spesmilo/event_listener
EventListener class to handle callbacks
2022-06-22 00:12:34 +00:00
SomberNight
5b000a871f EventListener follow-ups: adapt left-out classes and minor clean-ups 2022-06-22 02:09:26 +02:00
ThomasV
dbf055de9a EventListener class to handle callbacks
and QtEventListener for Qt
2022-06-22 02:07:46 +02:00
SomberNight
fbb3491e97 fix typo: stdio gui with no wallet
same as https://github.com/spesmilo/electrum/pull/3223 - should have been included there
2022-06-22 00:38:41 +02:00
ThomasV
034bd42d9c text guii: display full history 2022-06-17 12:59:35 +02:00
ThomasV
55f46fb61e adb fixes for text and stdio GUIs 2022-06-17 10:04:28 +02:00
ThomasV
e1d34300e5 lnworker: get_payment_value
- the detection of self-payments was using the length
   of the htlc list, incorrectly categorizing all MPPs.
 - the fee for self-payments was not correctly computed.
2022-06-16 21:02:34 +02:00
ThomasV
79428756b2 kivy: in event handlers, check wallet.
We might receive events before the wallet is loaded.
2022-06-16 16:50:31 +02:00
ThomasV
f1289a2a5e fix #7851: store addresses_beyond_gap_limit in address_list 2022-06-16 08:52:30 +02:00
ThomasV
cfb6ab6822 Trampoline: always increase fees, to ensure we do not get stuck in a loop.
Also handle TEMPORARY_CHANNEL_FAILURE, which is sometimes returned by Eclair.
2022-06-15 19:18:04 +02:00
ThomasV
9fe93524b7 Index lightning requests with rhash instead of onchain address.
get_unused_addresses() has been broken since #7730, because
addresses are considered as permanently used if they are in
the list of keys of receive_requests. This is true even if
an address is used as fallback for a lightning payment. This
means that the number of lightning payments we can receive
is constrained by the gap limit.

If a payment succeeds off-chain, we want to be able to reuse
its fallback address in other requests (this does not reduce
privacy, because invoices already share the same public key).

This implies that we should not use the onchain address as key
for lightning-enabled requests in wallet.receive_requests. If
we did, paid invoices would be overwritten when the address is
reused. That is the reason for the wallet_db upgrade.

Related: a3faf85e3c
2022-06-15 18:44:52 +02:00
ThomasV
adb5b6213b follow-up a3faf85e3c 2022-06-14 20:33:19 +02:00
ThomasV
1915330039 Qt receive widgets: do not show request that have expired
They may still be retrieved from the menu
2022-06-14 20:26:54 +02:00
ThomasV
c7418d4dc7 Qt: payment received notification, show label and amount instead of key
The key may be a bitcoin address, even for a lightning payment.
2022-06-14 20:10:24 +02:00
ThomasV
7df24f0adf fix typo 2022-06-14 17:14:02 +02:00