1
0
Commit Graph

13694 Commits

Author SHA1 Message Date
bitromortac
63308f94a0 reorganize with_lock decorator 2021-04-02 09:38:39 +02:00
SomberNight
92226b077a qt tx dialog: handle fiat fee for zero-fee tx
fix #7166
2021-04-01 17:02:34 +02:00
ThomasV
774a9ad263 fix #7164 2021-04-01 14:42:52 +02:00
ThomasV
5b1d54d014 fix #7165 2021-04-01 14:25:39 +02:00
SomberNight
a2ed95340c locale/i18n: set language as early as possible
related: #7158
related: #4621
2021-04-01 04:36:02 +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
SomberNight
f87727c195 android build: update kivy
fixes #7155

using older kivy master due to #7156
2021-03-31 21:51:57 +02:00
SomberNight
3811158169 windows build: (trivial) convert whitespaces in unsign.sh 2021-03-31 19:20:12 +02:00
SomberNight
c23fca37d4 build: clarify which locale files are included
related: 2cb4e56be3
4.1.0
2021-03-31 17:00:39 +02:00
SomberNight
815cc5a1d8 gitignore: add some macOS specific stuff 2021-03-31 13:52:48 +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
ThomasV
21b628d7a1 Merge pull request #7153 from SomberNight/202103_ks_seed_type
keystore to store seed_type; wallet.init_lightning() to sometimes create deterministic LN keys
2021-03-31 05:17:54 +02:00
SomberNight
537ec92460 wallet: change init_lightning to sometimes create deterministic LN keys 2021-03-30 21:53:18 +02:00
SomberNight
35bc461fe1 keystore: encapsulate "can_have_deterministic_lightning_xprv" logic 2021-03-30 21:31:37 +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
SomberNight
8ea2b4432a tests: add test for keystore.get_lightning_xprv 2021-03-30 19:05:42 +02:00
ThomasV
182f41fe84 (minor) rephrasing 2021-03-30 19:04:06 +02:00
ThomasV
e0b57016fa final release notes 2021-03-30 18:57:46 +02:00
SomberNight
f830939586 lnworker: change crypto for onchain static backups
Use scripthash as nonce instead of scriptPubKey,
as first two bytes of scriptPubKey are static, i.e. wasted.
2021-03-30 18:48:17 +02:00
SomberNight
ce4e556e20 update locale 2021-03-30 18:01:43 +02:00
SomberNight
e2e8cf1043 wallet: (minor) fix filtering history by year
E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\main_window.py", line 870, in timer_actions
    self.update_wallet()
  File "...\electrum\electrum\gui\qt\main_window.py", line 1003, in update_wallet
    self.update_tabs()
  File "...\electrum\electrum\gui\qt\main_window.py", line 1010, in update_tabs
    self.history_model.refresh('update_tabs')
  File "...\electrum\electrum\util.py", line 412, in <lambda>
    return lambda *args, **kw_args: do_profile(args, kw_args)
  File "...\electrum\electrum\util.py", line 408, in do_profile
    o = func(*args, **kw_args)
  File "...\electrum\electrum\gui\qt\history_list.py", line 329, in refresh
    self.view.filter()
  File "...\electrum\electrum\gui\qt\util.py", line 705, in filter
    self.hide_rows()
  File "...\electrum\electrum\gui\qt\util.py", line 709, in hide_rows
    self.hide_row(row)
  File "...\electrum\electrum\gui\qt\util.py", line 685, in hide_row
    should_hide = self.should_hide(row_num)
  File "...\electrum\electrum\gui\qt\history_list.py", line 445, in should_hide
    date = tx_item['date']
KeyError: 'date'
2021-03-30 17:48:46 +02:00
ThomasV
bbdfde5b41 fix capital gains 2021-03-30 17:32:43 +02:00
ThomasV
f632fec3c2 more release notes 2021-03-30 12:45:51 +02:00
ThomasV
a1666b259d (minor) release notes 2021-03-30 12:31:32 +02:00
ThomasV
744457d4bc update release notes 2021-03-30 12:25:10 +02:00
ThomasV
cd4df2fd85 detect conflicting channel backups, add warning before channel creation 2021-03-30 09:55:18 +02:00
SomberNight
f2040b19ea lnpeer: log both sent and recv msgs; use pubkey for incoming transports
Previously for incoming transports, the diagnostic_name (for log messages)
was just "responder" -- not sufficient to distinguish peers.
We now use the pubkey instead.

For outgoing transports it is f"{host}:{port}" (unchanged).
We could just use the pubkey for both uniformly; but it is quite long, and
it is hard to distinguish them at a glance.
2021-03-29 21:29:51 +02:00
SomberNight
5a3ec45b16 lnworker: fix another peer-handling race
(related to prev commit, but really another bug)

If we had two peers with the same pubkey (peer A in the process of teardown, peer B ~freshly connected),
peer A might remove peer B from lnworker.peers via close_and_cleanup().

rm `close_and_cleanup()` call from reestablish_channel - it was added
as a workaround for this bug (in 8b95b2127d)
before we understood the cause.
2021-03-29 20:51:54 +02:00
SomberNight
0c81414304 lnworker: handle multiple transports with same remote node id
If a remote node tries to establish a transport with us but we already
have an open transport with such a node id, there are two sane ways to go, either:
- keep existing transport open, reject new transport
- close existing transport, establish new transport

We could do either; I chose to do the second option here, as that is what
lnd and eclair seem to be doing.
Previously we would get into an inconsistent state: both transports open,
but only one of them stored in lnworker.peers.
2021-03-29 19:12:56 +02:00
ThomasV
8b95b2127d regtest backups: test both cases (onchain and imported)
lnpeer: call close_and_cleanup() after we force close,
or the above test will fail.
2021-03-29 19:08:31 +02:00
ThomasV
e38dabf502 lnchannel: get_state_for_GUI minor fix 2021-03-29 18:37:13 +02:00
ThomasV
602437bd17 fix remove_channel_backup (typo) 2021-03-29 18:18:41 +02:00
SomberNight
a509573ea0 lnrater: don't suggest nodes we have a channel backup with
We don't want to connect to nodes we already have a channel with on another device.
2021-03-29 17:49:27 +02:00
ThomasV
f06433e435 fix privkey in request_force_close_from_backup 2021-03-29 17:35:04 +02:00
SomberNight
f9ae47eb99 lnworker.num_sats_can_send should not return negative values 2021-03-29 16:20:24 +02:00
SomberNight
c5a677f4c9 qt channels list: hide unnamed column from "Copy" context menu 2021-03-29 16:14:40 +02:00
ThomasV
cedd2baad7 prepare release notes for 4.1.0 2021-03-29 14:16:06 +02:00
ThomasV
3fc85725aa Merge pull request #7135 from SomberNight/202103_get_utxos_at_height
wallet: implement get_utxos at specific block height
2021-03-29 11:03:11 +02:00
ghost43
6ed19c74a5 Merge pull request #7145 from SomberNight/202103_sdist_build_package_data
sdist build: let pip install put ~everything from tar.gz to site-packages
2021-03-28 16:54:27 +00: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