1
0
Commit Graph

1305 Commits

Author SHA1 Message Date
SomberNight
e686b40819 qt init: don't catch BaseException unless there is good reason
let KeyboardInterrupt propagate out
2021-04-03 01:47:44 +02:00
SomberNight
34e64ef152 qt gui: some more clean-up when exiting
related: https://github.com/spesmilo/electrum/issues/6889

This fixes the case where the user quits by pressing Ctrl+C,
and some other minor things.

There is still another issue that sometimes causes a segfault during shutdown...
2021-04-03 01:44:42 +02:00
ThomasV
039d11e350 Qt swap dialog: do not call update() from the asyncio thread. Fixes some segfaults that were triggered by opening the dialog 2021-04-02 15:33:37 +02:00
SomberNight
210ff647fa i18n: don't translate empty string
see #7158

```
$ ./contrib/pull_locale
Found 260 files to translate
Generate template
electrum/gui/qt/installwizard.py:265: warning: Empty msgid.  It is reserved by GNU gettext:
                                               gettext("") returns the header entry with
                                               meta information, not the empty string.
electrum/gui/qt/channels_list.py:49: warning: Empty msgid.  It is reserved by GNU gettext:
                                              gettext("") returns the header entry with
                                              meta information, not the empty string.
```
2021-04-01 03:33:16 +02:00
ThomasV
e13e0b11f1 Do not display the warning about static backups in init_lightning. It is not useful to display the same message twice. 2021-03-31 11:00:55 +02:00
ThomasV
bf6ecb6418 make init_lightning callable at runtime, without reloading the wallet 2021-03-31 10:57:36 +02:00
ThomasV
4b586d9cf0 kivy: remove dead code (follow-up 64a931f21e) 2021-03-31 09:51:16 +02:00
ThomasV
0459d4adb9 history_list: use from_timestamp and to_timestamp in summary 2021-03-31 06:07:29 +02:00
ThomasV
b0cf9dbeb3 kivy: remove unnecessary friction in _enable_lightning 2021-03-31 05:34:34 +02:00
SomberNight
537ec92460 wallet: change init_lightning to sometimes create deterministic LN keys 2021-03-30 21:53:18 +02:00
SomberNight
7b7bba2299 wallet_db: put 'seed_type' into keystores (incl db upgrade) 2021-03-30 21:16:14 +02:00
SomberNight
2cebdc8c1c add back "lightning is experimental" warning text 2021-03-30 19:55:48 +02:00
ThomasV
bbdfde5b41 fix capital gains 2021-03-30 17:32:43 +02:00
ThomasV
cd4df2fd85 detect conflicting channel backups, add warning before channel creation 2021-03-30 09:55:18 +02:00
SomberNight
c5a677f4c9 qt channels list: hide unnamed column from "Copy" context menu 2021-03-29 16:14:40 +02:00
ghost43
49233a31d5 Merge pull request #7142 from SomberNight/202103_fix_swap_amounts
swaps: revise send/recv amount calculation
2021-03-28 16:47:18 +00:00
SomberNight
9e62d1d763 swaps: (fix) for forward swaps, correctly consider num_sats_can_receive
Previously the min() was passed lightning amounts and on-chain amounts mixed;
which is conceptually a type error. It is now only passed on-chain amounts.
Due to the bug, we did not allow a swap to fully exhaust out "LN receive" capacity.
Now the max amt can be slighly larger.
2021-03-28 18:36:08 +02:00
SomberNight
63ea5587a2 swaps: revise send/recv amount calculation
- document SwapManager._get_recv_amount and SwapManager._get_send_amount
- change calculations so that they match the boltz-backend
  - note that in the reverse swap case, the server does not care about the on-chain claim tx the client
    needs to pay for. This introduced some implicit hacks and inconsistencies in the code in the past,
    it is still a bit ugly but at least this is now explicit.
- SwapManager._get_recv_amount and SwapManager._get_send_amount are now proper inverses of each other

-----

Here are some code snippets to play around with in Qt console.
For the forward swap case:
```
from electrum import ecc; lnworker = wallet.lnworker; sm = lnworker.swap_manager

invoice = network.run_from_another_thread(lnworker.create_invoice(amount_msat=3000000*1000, message="swap", expiry=86400))[1]; request_data = {"type": "submarine", "pairId": "BTC/BTC", "orderSide": "sell", "invoice": invoice, "refundPublicKey": ecc.GENERATOR.get_public_key_bytes().hex()}

network.send_http_on_proxy('post', sm.api_url + '/createswap', json=request_data, timeout=30)

sm.get_send_amount(3000000, is_reverse=False)
sm.get_recv_amount(3026730, is_reverse=False)
```

For the reverse swap case:
```
from electrum import ecc; import os; lnworker = wallet.lnworker; sm = lnworker.swap_manager

request_data = {"type": "reversesubmarine", "pairId": "BTC/BTC", "orderSide": "buy", "invoiceAmount": 3000000, "preimageHash": os.urandom(32).hex(), "claimPublicKey": ecc.GENERATOR.get_public_key_bytes().hex()}

network.send_http_on_proxy('post', sm.api_url + '/createswap', json=request_data, timeout=30)

sm.get_recv_amount(3000000, is_reverse=True)
sm.get_send_amount(2974443, is_reverse=True)
```
2021-03-28 18:36:04 +02:00
ThomasV
9110648415 Qt: minor changes to open channel dialog 2021-03-28 15:11:21 +02:00
ThomasV
4cf40107a2 (minor) rm confusing adjective 2021-03-28 11:35:09 +02:00
ThomasV
f6b2e63b2a Qt: invert trampoline checkbox in settings dialog. Share the help message with Kivy 2021-03-28 11:29:09 +02:00
ThomasV
a4210ce5e7 Qt: remove the 'local watchtower' option from GUI.
It is not realistic to expect Electrum to be used as a watchtower
in GUI mode, and possibly counter-productive (may set wrong
expectations).

A proper watchtower should be configured as a daemon. The
documentation will be updated to reflect this change.
2021-03-28 10:44:03 +02:00
ThomasV
345c2b4295 qt: tooltip formatting function 2021-03-28 09:57:00 +02:00
ThomasV
ac5565ed0a kivy: minor GUI improvements 2021-03-27 12:19:38 +01:00
ThomasV
41f22df26b submarine swaps: use num_sats_can_receive_no_mpp, to prevent funds being locked 2021-03-26 16:27:32 +01:00
ThomasV
4b870f15a7 fix wrong call to request_force_close_from_backup, make it private 2021-03-25 12:26:43 +01:00
ThomasV
241bf9ddd1 kivy: if password is unified, allow user to reset pin code 2021-03-25 10:27:18 +01:00
ThomasV
4b0f439301 (minor) follow-up ed6eea9161 2021-03-24 13:34:51 +01:00
ThomasV
130842ecd4 Add 'has_onchain_backup' to channel storage, to fix the displayed icon.
Note that this will not fix the value for already existing channels
that have been created with onchain backup; one would need a wallet_db
upgrade in order to fix them (probably not worth the effort).
2021-03-24 11:15:24 +01:00
ThomasV
ed6eea9161 kivy: make sure there is only one resume dialog 2021-03-24 10:48:01 +01:00
ThomasV
a95bdbb331 kivy: count open channels 2021-03-24 10:33:56 +01:00
ThomasV
18d7db12da Change warning shown on first channel creation
Qt: if created channel is not recoverable, show channel backup after creation
2021-03-24 10:24:14 +01:00
ThomasV
f2aa52e5aa minor: fix channel backup icon 2021-03-24 06:48:17 +01:00
ThomasV
2b3c64a9d7 qt: use the same 'nocloud' icon in wallet information 2021-03-24 06:25:35 +01:00
ThomasV
ca6cfbc6b0 channels list: group icons to save space 2021-03-24 06:11:53 +01:00
SomberNight
db37938963 qt channels list: add "features" column with icons (e.g. trampoline) 2021-03-23 21:34:04 +01:00
ThomasV
9583887c1f qt: change backup icon, add tooltip 2021-03-23 18:07:44 +01:00
ThomasV
cd6a468fb9 Android: unify password as soon as we know it is possible 2021-03-23 17:49:27 +01:00
ThomasV
a5fea043d1 Allow user to remove onchain backups. 2021-03-23 14:41:37 +01:00
ThomasV
ec01380105 kivy: channels list improvements 2021-03-23 14:26:54 +01:00
ThomasV
a67fcdbc8a channels_list: use icon to tell apart channels from backups 2021-03-23 14:06:28 +01:00
ThomasV
1a49fd440d kivy: add option to request force-close 2021-03-21 15:26:17 +01:00
Benoit Verret
f731c38293 Minor style changes 2021-03-21 00:36:23 -04:00
SomberNight
beba807cfe qt ChannelsList: fix opening channel with "max" amount 2021-03-20 19:20:49 +01:00
ThomasV
2509eaa642 Qt: clarify use_gossip checkbox text 2021-03-19 14:07:04 +01:00
ThomasV
27dcfba98d channels_list: improve menu for backups 2021-03-19 13:57:17 +01:00
ThomasV
afcc695f4d channels_list: show backup text in the state column. fix missing import in previous commit. 2021-03-19 13:35:12 +01:00
ThomasV
2fee920f43 On Android, if channels are not recoverable, display channel backup when a new channel is created.
Remove the 'android_backups' setting, which was unpractical.
2021-03-19 13:17:58 +01:00
ThomasV
64a931f21e Deterministic NodeID:
- use_recoverable_channel is a user setting, available
   only in standard wallets with a 'segwit' seed_type
 - if enabled, 'lightning_xprv' is derived from seed
 - otherwise, wallets use the existing 'lightning_privkey2'

Recoverable channels:
 - channel recovery data is added funding tx using an OP_RETURN
 - recovery data = 4 magic bytes + node id[0:16]
 - recovery data is chacha20 encrypted using funding_address as nonce.
   (this will allow to fund multiple channels in the same tx)

GUI:
  - whether channels are recoverable is shown in wallet info dialog.
  - if the wallet can have recoverable channels but has an old node_id,
    users are told to close their channels and restore from seed
    to have that feature.
2021-03-19 10:17:02 +01:00
ThomasV
9e6996c5c1 qt: use 'local' icon for future transactions 2021-03-18 09:21:36 +01:00