Commit Graph

534 Commits

Author SHA1 Message Date
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: https://github.com/spesmilo/electrum/commit/5e0df77df6b06330284e2c15e188fbb4a9865fdb

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
ThomasV e3beae5c00 Merge pull request #7761 from SomberNight/202204_versioninfo_cmd
add `version_info` command
2022-04-27 09:59:27 +02:00
Rogach 6d049a30f2 fix typo in warning message shown when enabling lightning (#7782) 2022-04-25 21:35:42 +00:00
SomberNight adfe542fae wallet_db upgrade: recalc keys of outgoing on-chain invoices
closes https://github.com/spesmilo/electrum/issues/7777
2022-04-22 19:53:55 +02:00
ThomasV fb6047ec46 lnworker: fix can_pay_invoice for trampoline MPP
Call it from the GUI
2022-04-22 15:13:12 +02:00
ThomasV cbb51b31d8 kivy updates 2022-04-20 12:48:22 +02:00
SomberNight e47e0afa91 commands: add "version_info" cmd
example:
```
$ ./run_electrum -o version_info
{
    "aiohttp.version": "3.8.1",
    "aiorpcx.version": "0.22.1",
    "certifi.version": "2021.10.08",
    "cryptodome.version": null,
    "cryptography.path": "/home/user/.local/lib/python3.8/site-packages/cryptography",
    "cryptography.version": "3.4.6",
    "dnspython.version": "2.2.0",
    "electrum.path": "/home/user/wspace/electrum/electrum",
    "electrum.version": "4.2.1",
    "hidapi.version": "0.11.0.post2",
    "libsecp256k1.path": "/home/user/wspace/electrum/electrum/libsecp256k1.so.0",
    "libusb.path": "libusb-1.0.so",
    "libusb.version": "1.0.23.11397",
    "libzbar.path": "/home/user/wspace/electrum/electrum/libzbar.so.0",
    "pyaes.version": "1.3.0",
    "pyqt.path": "/usr/lib/python3/dist-packages/PyQt5",
    "pyqt.version": "5.14.1",
    "qt.version": "5.12.8"
}
```
2022-04-11 17:40:22 +02:00
SomberNight 419fc6e1c1 gui init: raise GuiImportError instead of sys.exit if dep is missing 2022-04-11 17:40:16 +02:00
SomberNight 837fc1606c address_sync: change up_to_date to be private; no lock needed to read
After some consideration I am fairly certain there is no need to take
wallet.lock in `is_up_to_date()`. Any caller that might want some kind
of guarantees re the value returned by is_up_to_date() would need to
enforce them itself by e.g. taking wallet.lock around its critical code
block. That is, even if is_up_to_date() itself takes the lock, between
the call returning and the caller reading the value there could still
have been a race.
Also, the GUI was directly accessing the field already.
2022-04-08 20:33:13 +02:00
SomberNight 7268fa55f2 config: abstract away mempool depth format str "%.1f MB from tip"
related: https://github.com/spesmilo/electrum/commit/4dd94172a6dc87a32bd6b0542c7c985f23afab1f
(as that commit introduced depth targets that need more precision to display)
2022-03-31 22:50:31 +02:00
SomberNight 68ba223ce1 qt ConfirmTxDialog: word-wrap error message text
e.g. this text:
"This transaction requires a higher fee, or it will not be propagated by your current server. Try to raise your transaction fee, or use a server with a lower relay fee."
is too long for a single line.
2022-03-29 20:15:52 +02:00
SomberNight 25fee6a6be kivy: locale: set default language to English
This reverts 7cb11ceda4 (set default language to OS lang).
Some languages (e.g. CJK, Arabic) do not work at all with kivy due to font issues,
so we should never use those as default. It is easiest to just default to English for now.

related https://github.com/spesmilo/electrum/issues/2032
related https://github.com/spesmilo/electrum/issues/4618
related https://github.com/spesmilo/electrum/issues/7494
2022-03-22 17:20:33 +01:00
SomberNight b91947e585 kivy: delete some dead code 2022-03-22 16:28:04 +01:00
SomberNight 3e42f2f33d kivy: fix cpfp dialog: qt not available on android
(and the imports are unused.)

fixes https://github.com/spesmilo/electrum/issues/7723
2022-03-19 00:02:54 +01:00
SomberNight 3771553a2c crash reporter: if disabled via config, make sure EEQueue is flushed
If the user had `config.get("show_crash_reporter")==False`, they would
never get to see excs collected via `send_exception_to_crash_reporter(exc)`.

E.g.:
```
E | gui.qt.ElectrumGui | error loading wallet (or creating window for it)
Traceback (most recent call last):
  File "/opt/electrum/electrum/gui/qt/__init__.py", line 433, in main
    if not self.start_new_window(path, self.config.get('url'), app_is_starting=True):
  File "/opt/electrum/electrum/gui/qt/__init__.py", line 307, in wrapper
    return func(self, *args, **kwargs)
  File "/opt/electrum/electrum/gui/qt/__init__.py", line 332, in start_new_window
    wallet = self._start_wizard_to_select_or_create_wallet(path)
  File "/opt/electrum/electrum/gui/qt/__init__.py", line 377, in _start_wizard_to_select_or_create_wallet
    db = WalletDB(storage.read(), manual_upgrades=False)
  File "/opt/electrum/electrum/wallet_db.py", line 73, in __init__
    self.load_data(raw)
  File "/opt/electrum/electrum/wallet_db.py", line 104, in load_data
    self._after_upgrade_tasks()
  File "/opt/electrum/electrum/wallet_db.py", line 202, in _after_upgrade_tasks
    self._load_transactions()
  File "/opt/electrum/electrum/util.py", line 439, in <lambda>
    return lambda *args, **kw_args: do_profile(args, kw_args)
  File "/opt/electrum/electrum/util.py", line 435, in do_profile
    o = func(*args, **kw_args)
  File "/opt/electrum/electrum/wallet_db.py", line 1310, in _load_transactions
    self.data = StoredDict(self.data, self, [])
  File "/opt/electrum/electrum/json_db.py", line 79, in __init__
    self.__setitem__(k, v)
  File "/opt/electrum/electrum/json_db.py", line 44, in wrapper
    return func(self, *args, **kwargs)
  File "/opt/electrum/electrum/json_db.py", line 97, in __setitem__
    v = self.db._convert_dict(self.path, key, v)
  File "/opt/electrum/electrum/wallet_db.py", line 1361, in _convert_dict
    v = dict((k, SwapData(**x)) for k, x in v.items())
```
2022-03-15 13:39:33 +01:00
SomberNight 841a701acf kivy: show error when failing to save wallet file backup
related: https://github.com/spesmilo/electrum/issues/6774#issuecomment-856098099
2022-03-14 16:45:07 +01:00
ThomasV b268877d53 Merge pull request #7636 from bitromortac/2201-channel-type
lightning: implement channel types
2022-02-21 12:08:54 +01:00
SomberNight 88121d7924 kivy ln invoice: handle missing 'd' tag
fixes https://github.com/spesmilo/electrum/issues/6262
2022-02-18 16:37:46 +01:00
bitromortac c203ce083a kivy+qt: add channel type to details 2022-01-20 16:47:49 +01:00
SomberNight 0df05dd914 qt preferences: always show cb for LN/"Create recoverable channels"
This makes it explicit that the option cannot be enabled if so (instead of hiding the checkbox).
2021-11-17 17:54:52 +01:00
SomberNight ed0dd6eb22 kivy: implement ElectrumGui.stop 2021-11-05 20:35:28 +01:00
SomberNight ca9b48e2d6 gui: add BaseElectrumGui base class for guis 2021-11-05 20:21:50 +01:00
SomberNight c331c311db crash reporter: add EarlyExceptionsQueue
`util.send_exception_to_crash_reporter` is now useful and can be transparently
used even before the exception hook is set up.
2021-11-05 20:01:43 +01:00
SomberNight 99836d5e5f kivy: confirm_tx_dialog: toggling "final" should update the tx
We create a tx when the dialog is created, and re-create it every time
the user moves the fee slider. However, we were not re-creating it if
the user toggles the "Final" checkbox, meaning its value was only taken
into account if the user moved the fee slider after setting the checkbox.

fixes https://github.com/spesmilo/electrum/issues/7547
2021-10-29 14:27:13 +02:00