1
0
Commit Graph

557 Commits

Author SHA1 Message Date
SomberNight
373db76ac9 util: kill bh2u
no longer useful, and the name is so confusing...
2023-02-17 11:43:11 +00:00
ThomasV
e1dc7d1e6f Set the RBF flat to all transactions, and remove the 'use_rbf'
preference from the GUI, because the mempoolfullrbf option in
Bitcoin 0.24 makes RBF signaling pretty meaningless. Fixes #8088.

Note: RBF remains disabled for channel funding transactions.
In that case, the flag is actually only used as a semaphore
between different instances of the same wallet.
2022-12-10 18:58:15 +01:00
ThomasV
e8ac09721c kivy: remove user_rbf boolean property (unused) 2022-12-07 15:59:11 +01:00
SomberNight
01b5e3f8e0 flake8: enable more mandatory tests 2022-10-31 16:13:22 +00:00
accumulator
6e536d2d91 add invoice status to invoice_status callback (#8020)
* add invoice status to invoice_status callback

* debug statement fails tests

* removed commented lines, added progress/attempt counter comment in lnworker.pay_to_node,
and update the invoice_status event handler in qeinvoicelistmodel.py
2022-10-21 16:45:12 +00:00
sorenstoutner
f995a5001d Fix CRLF issues. (#8026) 2022-10-20 18:43:54 +00:00
ghost43
b619e2b3af Merge pull request #8003 from SomberNight/202210_android_debug_logs
android: add setting to enable debug logs
2022-10-10 19:03:52 +00:00
SomberNight
174cbde762 kivy: window.request_focus_for_main_view: fix compat with newer pyjnius
```
Traceback (most recent call last):
  File "kivy/_clock.pyx", line 645, in kivy._clock.CyClockBase._process_events
  File "kivy/_clock.pyx", line 218, in kivy._clock.ClockEvent.tick
  File "/home/user/wspace/electrum/.buildozer_kivy/android/app/electrum/gui/kivy/uix/dialogs/password_dialog.py", line 227, in <lambda>
  File "/home/user/wspace/electrum/.buildozer_kivy/android/app/electrum/gui/kivy/uix/dialogs/password_dialog.py", line 333, in <lambda>
  File "/home/user/wspace/electrum/.buildozer_kivy/android/app/electrum/gui/kivy/main_window.py", line 721, in on_open_wallet
  File "/home/user/wspace/electrum/.buildozer_kivy/android/app/electrum/gui/kivy/main_window.py", line 687, in on_wizard_success
  File "/home/user/wspace/electrum/.buildozer_kivy/android/app/electrum/util.py", line 445, in <lambda>
  File "/home/user/wspace/electrum/.buildozer_kivy/android/app/electrum/util.py", line 441, in do_profile
  File "/home/user/wspace/electrum/.buildozer_kivy/android/app/electrum/gui/kivy/main_window.py", line 940, in load_wallet
  File "/home/user/wspace/electrum/.buildozer_kivy/android/app/electrum/gui/kivy/main_window.py", line 950, in request_focus_for_main_view
  File "jnius/jnius_export_class.pxi", line 844, in jnius.jnius.JavaMethod.__call__
jnius.jnius.JavaException: Cannot call instance method b'requestFocusForMainView' on class b'org/kivy/android/PythonActivity'
```
2022-10-10 14:43:43 +00:00
SomberNight
34b594ea40 android: add setting to enable debug logs
If enabled, we log to stderr, which can get inspected via logcat.
Not user-friendly at all - but previously there was no way to get logs from a release build.

closes https://github.com/spesmilo/electrum/issues/7409
2022-10-07 20:28:52 +00:00
ThomasV
028916b447 fix #7988 2022-09-23 09:41:46 +02:00
SomberNight
e5f21fb7b5 lnurl: better handle unimplemented lnurl subtypes
fixes https://github.com/spesmilo/electrum/issues/7971
2022-09-20 16:00:20 +00:00
ThomasV
14e96f4d53 Index request by ID instead of receiving address.
Replace get_key_for_outgoing_invoice, get_key_for_incoming_request
with Invoice.get_id()

When a new request is created, reuse addresses of expired requests (fixes #7927)

The API is changed for the following commands:
 get_request, get_invoice,
 list_requests, list_invoices,
 delete_request, delete_invoice
2022-09-02 10:58:11 +02:00
SomberNight
20997cf60b wallet: follow-up removal of get_request_status
follow-up d9f77a50e8
2022-08-29 12:27:05 +00:00
ThomasV
d9f77a50e8 wallet API: remove get_request_status, it is redundant with get_invoice_status 2022-08-29 09:48:08 +02:00
ThomasV
a11dbb1a76 kivy: save manually entered amount into lightning invoices, as in Qt (related: #7935) 2022-08-15 12:35:22 +02:00
ThomasV
8486168bbe fix typo 2022-08-13 07:41:48 +02:00
ThomasV
83feec2cb3 fix #7933 2022-08-12 18:07:38 +02:00
SomberNight
13570a465c kivy request dialog: follow-up c95791d7ee
related https://github.com/spesmilo/electrum/pull/7929
2022-08-12 11:10:54 +00:00
ThomasV
f65368f1d0 kivy request dialog: follow-up c95791d7ee:
- toggle between text and qr code
 - fix minor issues
2022-08-12 11:46:44 +02:00
SomberNight
c95791d7ee qt/kivy: receive tab: add wallet.ReceiveRequestHelp and refactor 2022-08-12 10:06:13 +02:00
SomberNight
ba72abdbf5 kivy request_dialog: default to LN if there is no URI 2022-08-11 19:39:55 +00:00
SomberNight
bd7a6a8f77 qt/kivy receive tab: show error msg when creating req with amt<dust 2022-08-11 14:55:34 +00:00
SomberNight
5f5e6b3cf3 kivy request_dialog: disable "lightning" btn if no LN part 2022-08-11 13:57:25 +00:00
SomberNight
1b2d46722c kivy request_dialog: rm some magic numbers
note: not sure how to use IntEnum with kivy's NumericProperty
2022-08-11 13:50:53 +00:00
SomberNight
7b095158bf wallet: add get_label_for_address, and make get_label private
fixes https://github.com/spesmilo/electrum/issues/7919

In the past, when creating payment requests, we keyed them by on-chain address,
and set/saved the msg of the request as label for the address.
Many places in the code were calling wallet.get_label(addr) with the expectation that
relevant payment requests are found and their message/description (if any) is considered.

wallet.get_label(key) is now made private, and instead the explicit non-polymorphic
wallet.get_label_for_{address,rhash,txid} alternatives should be used.
2022-08-09 17:21:14 +02:00
ThomasV
3afee67ea3 kivy GUI: show better error message if we cannot channel backup import because lightning is disabled or unavailable. fixes #7899 2022-07-21 09:11:55 +02:00
ThomasV
b5617ec0fd lnworker: get_channel_objects method to be used by GUI 2022-07-20 21:07:13 +02:00
SomberNight
d5b5f82b01 LN invoice: better handle unknown required featured bits in bolt11 invs
A user provided an invoice that requires feature bit 30. (That bit is not in the spec)
To test:
```
lnbc1p324a66pp5tundykxx3q5kztsr8x00eknpn2uwe3394cnky3j9a0fswm568wnsdp9facx2mj5d9kk2um5v9khqueqv3hkuct5d9hkucqzpgxq9z0rgqsp5l73jgfgctzc92juer5rk2mqcrkj8teng53dr9vfxj4n8lulu4jmq9q8pqqqssq4gacn859tpzz99hkusnh7m93d5ncpx3t4zns8ynca7akmljpl5vh504qjz7dqwewqjh4md7xagaz5wg85knvxywrhp0sp2t09yta7lcq3qs6fy

lntb1p324a66pp5tundykxx3q5kztsr8x00eknpn2uwe3394cnky3j9a0fswm568wnssp5l73jgfgctzc92juer5rk2mqcrkj8teng53dr9vfxj4n8lulu4jmqdp9facx2mj5d9kk2um5v9khqueqv3hkuct5d9hkuxq9z0rgq9q8pqqqssqdte0z9dy7ur7fagsk7r3mtfj6upq88xfylhufys87zqpamklcfgn2f3xeq3nlhvn3qy9tdgg42vq9eq99qz6rz6tzqezfhzuv6zsr5qp7cgel4
```
2022-07-15 18:00:33 +02:00
SomberNight
056de017f0 wallet: use get_request(addr) instead of receive_requests[addr]
since "invoice unification", requests are often keyed by rhash
2022-07-12 15:38:54 +02:00
ThomasV
9ae0e5bffc remove lightning parameter from wallet.create_request 2022-07-11 13:52:13 +02:00
ThomasV
957174a039 all GUIs: show local and remote force-close options in a homogeneous way 2022-07-11 13:08:04 +02:00
SomberNight
c463f5e23d password unification refactor: move methods from wallet to daemon
Note in particular that check_password_for_directory was not safe to use while the daemon had wallets loaded,
as the same file would have two corresponding Wallet() instances in memory. This was specifically handled in
the kivy GUI, on the caller side, by stopping-before and reloading-after the wallets; but it was dirty to
have the caller handle this.
2022-07-06 19:57:27 +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
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
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
ThomasV
dbf055de9a EventListener class to handle callbacks
and QtEventListener for Qt
2022-06-22 02:07:46 +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
SomberNight
f12e87be93 lnchannel: add new states: WE_ARE_TOXIC, REQUESTED_FCLOSE
The `WE_ARE_TOXIC` state is added as a sanity check to ensure that if
the remote has proven that we have lost state we do not accidentally
do a local force-close. E.g. if we receive an "error" message for the
channel, we might normally do an automatic force-close. Manually
force-closing in such a state is not offered anymore by the GUI.

The `REQUESTED_FCLOSE` state is added as it is quite likely that
we receive an error message from the remote after requesting a fclose,
e.g. during a later chan-reestablish. In such a scenario, we should
not do an auto-local-fclose, however the manual option of a local-fclose
should still be offered.
2022-06-10 17:09:33 +02:00
ThomasV
151500fb72 follow-up afa2ed1fe285886fdd087aa8b1e303e2634d9098 2022-06-10 13:07:53 +02:00
ThomasV
121d8732f1 Persist LNWatcher transactions in wallet file:
- separate AddressSynchronizer from Wallet and LNWatcher
 - the AddressSynchronizer class is referred to as 'adb' (address database)
 - Use callbacks to replace overloaded methods
2022-06-10 13:07:53 +02:00
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
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
ThomasV
ac8a29efc2 kivy: minor fix 2022-05-21 12:23:01 +02:00
SomberNight
2c57c78ebe asyncio: stop using get_event_loop(). introduce ~singleton loop.
asyncio.get_event_loop() became deprecated in python3.10. (see https://github.com/python/cpython/issues/83710)
```
.../electrum/electrum/daemon.py:470: DeprecationWarning: There is no current event loop
  self.asyncio_loop = asyncio.get_event_loop()
.../electrum/electrum/network.py:276: DeprecationWarning: There is no current event loop
  self.asyncio_loop = asyncio.get_event_loop()
```
Also, according to that thread, "set_event_loop() [... is] not deprecated by oversight".
So, we stop using get_event_loop() and set_event_loop() in our own code.
Note that libraries we use (such as the stdlib for python <3.10), might call get_event_loop,
which then relies on us having called set_event_loop e.g. for the GUI thread. To work around
this, a custom event loop policy providing a get_event_loop implementation is used.

Previously, we have been using a single asyncio event loop, created with
util.create_and_start_event_loop, and code in many places got a reference to this loop
using asyncio.get_event_loop().
Now, we still use a single asyncio event loop, but it is now stored as a global in
util._asyncio_event_loop (access with util.get_asyncio_loop()).

I believe these changes also fix https://github.com/spesmilo/electrum/issues/5376
2022-04-29 18:49:07 +02:00
ThomasV
f4e902e907 LNWorker: give up payment after timeout, not number of attempts.
Limiting attempts may interrupt a MPP before we receive a MPP_timeout
The attempts parameter is still used in unit tests.
2022-04-29 12:17:38 +02:00
ThomasV
96433ea2b4 Merge pull request #7778 from SomberNight/202204_invoice_recalc_ids
wallet_db upgrade: recalc keys of outgoing on-chain invoices
2022-04-28 15:12:29 +02:00