1
0
Commit Graph

13675 Commits

Author SHA1 Message Date
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
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
03a95f36fc add trampoline.hodlister.co 2021-03-28 06:05:04 +02:00
Axel Gembe
6e1caf7e88 AppImage build: Include libxcb into the image
Ubuntu 20.04 needs `libxcb-xinerama.so.0`
and Debian 10 needs `libxcb-util.so.1` for the Qt `xcb` plugin.

-----

ported from 380f04a805

see https://github.com/Electron-Cash/Electron-Cash/issues/2196

-----

In particular, see this comment:

>> I confirmed that both Ubuntu 20.04 and Debian 10.8 clean install have an issue with the 4.2.4 AppImage.
>
> Any idea what broke it? I assume it used to work.

Yes, it did work in 4.2.3 which used PyQt5 5.13.2. I just had a look at the xcb plugin and it definitely has less dependencies:
```
ago@ubuntu2004vm:~/src/Electron-Cash/dist$ ldd squashfs-root/usr/lib/python3.6/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so|grep xcb
        libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f0ec9d07000)
        libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f0ec9cdd000)
        libxcb-xkb.so.1 => /lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007f0ec6ead000)
```

compared to PyQt5 5.15.2 in 4.2.4:
```
ago@ubuntu2004vm:~/src/Electron-Cash/dist$ ldd squashfs-root/usr/lib/python3.8/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so|grep xcb
        libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fcb5715f000)
        libxcb-icccm.so.4 => /lib/x86_64-linux-gnu/libxcb-icccm.so.4 (0x00007fcb57158000)
        libxcb-image.so.0 => /lib/x86_64-linux-gnu/libxcb-image.so.0 (0x00007fcb56f51000)
        libxcb-shm.so.0 => /lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007fcb56f4c000)
        libxcb-util.so.1 => /lib/x86_64-linux-gnu/libxcb-util.so.1 (0x00007fcb56d46000)
        libxcb-keysyms.so.1 => /lib/x86_64-linux-gnu/libxcb-keysyms.so.1 (0x00007fcb56d41000)
        libxcb-randr.so.0 => /lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x00007fcb56d2e000)
        libxcb-render-util.so.0 => /lib/x86_64-linux-gnu/libxcb-render-util.so.0 (0x00007fcb56d27000)
        libxcb-render.so.0 => /lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007fcb56d16000)
        libxcb-shape.so.0 => /lib/x86_64-linux-gnu/libxcb-shape.so.0 (0x00007fcb56d11000)
        libxcb-sync.so.1 => /lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007fcb56d07000)
        libxcb-xfixes.so.0 => /lib/x86_64-linux-gnu/libxcb-xfixes.so.0 (0x00007fcb56cfd000)
        libxcb-xinerama.so.0 => /lib/x86_64-linux-gnu/libxcb-xinerama.so.0 (0x00007fcb56cf8000)
        libxcb-xkb.so.1 => /lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007fcb56cda000)
        libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fcb56cae000)
```
2021-03-27 21:41:09 +01:00
ThomasV
e93becf33a wallet.add_transaction: prevent channel backup from being added twice 2021-03-27 14:29:10 +01:00
ThomasV
ac5565ed0a kivy: minor GUI improvements 2021-03-27 12:19:38 +01:00
SomberNight
2cb4e56be3 sdist build: let pip install put ~everything from tar.gz to site-packages
(well, not everything, only files in electrum/ (so e.g. not contrib))
See comment in setup.py.

E.g. we have been including the www/ folder in the tar.gz but have not been installing it
to site-packages. Now we do.
Or we have been including the kivy GUI files in the tar.gz but not installing them.
Now we do.

I like this because it simplifies setup.py and should be easier to reason about too.

should fix #7089 (at least when using the tar.gz)
2021-03-27 03:44:00 +01:00
SomberNight
472d112433 sdist build: (minor) exclude more stuff from tar.gz, rm git clean log
The `git clean --dry-run` became redundant with "fresh clone" builds.
The new exclude in MANIFEST.in should not affect production builds (also due to fresh clone),
but they are nice when building from dirty local dir.
2021-03-27 03:39:10 +01:00
SomberNight
1e3373bd2f cosigner_pool: fix #7134 2021-03-27 01:44:18 +01:00
krzysobo
7ea7e7cec9 bitcoin.address_to_scripthash: add net param (#7143)
closes #7141
2021-03-26 20:54:26 +00: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
bdd9c4823f hardcoded trampoline nodes: replace IPs with domain names 2021-03-26 15:49:10 +01:00
ThomasV
a642a11936 add another DNS seed 2021-03-26 14:28:34 +01:00
ThomasV
fdb0fe2f4c lnworker: guess routing fee in num_sats_can_send 2021-03-26 10:34:50 +01:00
ThomasV
b64fcfb9e3 lnpeer: if close_channel times out, check unconfirmed_closing_txid before raising an exception 2021-03-26 09:30:29 +01:00
SomberNight
5beadaab95 commands: clean-up inject_fees cmd 2021-03-25 19:33:40 +01:00
ThomasV
f14b7d5a12 check_password_for_directory: safeguards 2021-03-25 16:12:24 +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
6491421930 lnchannel: rename force_close_detected -> closing_detected, use it only if state is OPEN 2021-03-25 11:24:33 +01:00