1
0
Commit Graph

16936 Commits

Author SHA1 Message Date
SomberNight
b0401a6386 lnpeer.maybe_forward_trampoline: fix abs-cltv vs cltv-delta confusion
lnworker.pay_to_node(min_cltv_expiry=) expects a relative cltv, and
we were passing an absolute one.
It is not so clear what precisely should be passed here, and that is
because pay_to_node's API was not written with forwarding in mind.
The value chosen here is just some guess that typically should work.
2023-10-17 18:22:36 +00:00
SomberNight
0273659e6e trustedcoin: fix keystore name (2)
follow-up 56e80c20d7
2023-10-17 14:33:05 +00:00
SomberNight
a38e723b40 exchange_rate: cleaner log line for "failed fx quotes"
catch OSError for proxy-related issues (and probably other low level networking)

```
 19.52 | E | exchange_rate.CoinGecko | failed fx quotes: ProxyConnectionError(22, 'Can not connect to proxy localhost:9050 [The remote computer refused the network connection]')
Traceback (most recent call last):
  File "...\Python310\site-packages\python_socks\async_\asyncio\ext\_proxy.py", line 59, in _connect
    await self._stream.open_connection(
  File "...\Python310\site-packages\python_socks\async_\asyncio\ext\_stream.py", line 61, in open_connection
    self._reader, self._writer = await asyncio.open_connection(
  File "...\Python310\lib\asyncio\streams.py", line 48, in open_connection
    transport, _ = await loop.create_connection(
  File "...\Python310\lib\asyncio\base_events.py", line 1076, in create_connection
    raise exceptions[0]
  File "...\Python310\lib\asyncio\base_events.py", line 1060, in create_connection
    sock = await self._connect_sock(
  File "...\Python310\lib\asyncio\base_events.py", line 969, in _connect_sock
    await self.sock_connect(sock, address)
  File "...\Python310\lib\asyncio\proactor_events.py", line 709, in sock_connect
    return await self._proactor.connect(sock, address)
  File "...\Python310\lib\asyncio\windows_events.py", line 826, in _poll
    value = callback(transferred, key, ov)
  File "...\Python310\lib\asyncio\windows_events.py", line 613, in finish_connect
    ov.getresult()
ConnectionRefusedError: [WinError 1225] The remote computer refused the network connection

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "...\electrum\exchange_rate.py", line 85, in update_safe
    self._quotes = await self.get_rates(ccy)
  File "...\electrum\exchange_rate.py", line 345, in get_rates
    json = await self.get_json('api.coingecko.com', '/api/v3/exchange_rates')
  File "...\electrum\exchange_rate.py", line 69, in get_json
    async with session.get(url) as response:
  File "...\Python310\site-packages\aiohttp\client.py", line 1140, in __aenter__
    self._resp = await self._coro
  File "...\Python310\site-packages\aiohttp\client.py", line 535, in _request
    conn = await self._connector.connect(
  File "...\Python310\site-packages\aiohttp\connector.py", line 543, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "...\Python310\site-packages\aiohttp\connector.py", line 906, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "...\Python310\site-packages\aiohttp\connector.py", line 1174, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "...\Python310\site-packages\aiohttp_socks\connector.py", line 58, in _wrap_create_connection
    stream = await proxy.connect(
  File "...\Python310\site-packages\python_socks\async_\asyncio\ext\_proxy.py", line 47, in connect
    await self._connect()
  File "...\Python310\site-packages\python_socks\async_\asyncio\ext\_proxy.py", line 73, in _connect
    raise ProxyConnectionError(e.errno, msg) from e
python_socks._errors.ProxyConnectionError: [Errno 22] Can not connect to proxy localhost:9050 [The remote computer refused the network connection]
```
2023-10-17 14:30:15 +00:00
ThomasV
cd712f2f60 follow-up 1ea49582ab 2023-10-17 12:52:02 +02:00
ThomasV
1ea49582ab fix type of forwarding_info 2023-10-17 12:36:15 +02:00
ThomasV
026a64de94 channel_announcements:
- construct_channel_announcement: return also whether
   node ids are in reverse order
 - maybe_send_channel_announcement:
   return early if signatures have not been received
2023-10-17 12:15:35 +02:00
ThomasV
0a732a0b52 trustedcoin: fix keystore name (follow-up 56e80c20d7) 2023-10-17 10:00:17 +02:00
SomberNight
30c863d32c lnaddr: don't call validate_features in parser
- see comment in lnaddr.py
- Previously we used feature bit 50/51 for trampoline.
  The spec subsequently defined fbit 50/51 as option_zeroconf, which
  requires fbit 46/47 (option_scid_alias) to also be set.
  We moved the non-standard trampoline fbit to a different int.
  However, old wallets might have old invoices saved that set fbit 50/51
  for trampoline, and those would not have the dependent bit set.
  Invoices are parsed at wallet-open, so if the parser ran these checks,
  those wallets could not be opened.
- note: we could potentially also run lnaddr.validate_and_compare_features
  when saving new invoices into the wallet but this is not done here
2023-10-16 17:10:49 +00:00
ThomasV
98a4d7b60d public channels:
- send node and channel announcements.
 - store channel_flags in constraints
 - store signatures in local and remote configs
2023-10-16 13:54:16 +02:00
ThomasV
aad4fd6d48 Fix sending of 'channel_ready':
- send only once
 - in channel_reestablish, do not send it if we are not funded.
 - lnworker: do not send channel_ready before channel_reestablish
2023-10-15 10:58:37 +02:00
ThomasV
8d5f9185a4 follow-up #8646 2023-10-14 10:13:27 +02:00
ThomasV
ac177577a6 lnpeer: do not set channel OPEN before channel_ready has been both sent and received.
fixes #8641
2023-10-13 16:56:25 +02:00
Sander van Grieken
b20a4b9bf1 qml: increase font on seed keyboard, and height of seedkeyboard slightly 2023-10-13 13:42:16 +02:00
Sander van Grieken
8c4532c5cb qml: properly show warnings in info box in RbfBumpFeeDialog 2023-10-12 16:22:51 +02:00
Sander van Grieken
941f425ff5 qml: update invoice.canPay on channel state changes
This re-evaluates invoice.canPay when channels get connected/disconnected (enables/disables Pay button)
2023-10-12 15:53:15 +02:00
Sander van Grieken
8dbb2e0c33 qml: remove eye icon for watch-only wallets from toolbar 2023-10-12 15:17:16 +02:00
ThomasV
89023cc123 Remove trampoline hints from invoices
This has been deprecated for a long time, was kept only for
compatibility with old electrum clients.
2023-10-11 09:47:36 +02:00
SomberNight
57d2efc88d wallet: merge mktx and create_transaction 2023-10-10 17:45:26 +00:00
ThomasV
f4997c3771 follow-up 7576a99a0b 2023-10-10 19:41:37 +02:00
ThomasV
e882856d4f Merge pull request #8646 from accumulator/load_wallet_refactor
daemon: refactor load_wallet
2023-10-10 19:33:20 +02:00
ThomasV
7576a99a0b wallet.unlock: raise exception if password is missing (follow-up 2e52b17a43) 2023-10-10 19:23:09 +02:00
SomberNight
65394c37d5 wallet.make_unsigned_transaction: add batch_rbf/send_change params
Don't side-effect config just to modify the next call of make_unsigned_transaction >.<
Cleaner to pass parameters.
2023-10-10 17:13:18 +00:00
Sander van Grieken
7ca9b735d5 daemon: refactor load_wallet to not just return None, but raise specific exceptions.
The following exceptions should be expected:
FileNotFoundError: given wallet path does not exist
StorageReadWriteError: given file is not readable/writable or containing folder is not writable
InvalidPassword: wallet requires a password but no password or an invalid password was given
WalletFileException: any internal wallet data issue. specific subclasses can be caught separately:
-  WalletRequiresSplit: wallet needs splitting (split_data passed in Exception)
-  WalletRequiresUpgrade: wallet needs upgrade, and no upgrade=True was passed to load_wallet
-  WalletUnfinished: wallet file contains an action and needs additional information to finalize. (WalletDB passed in exception)

Removed qml/qewalletdb.py

This patch also fixes load_wallet calls in electrum/scripts and adds a qml workaround for dialogs opening and closing so
fast that the dialog opened==true property change is missed (which we need to manage the dialog/page stack)
2023-10-10 17:42:07 +02:00
SomberNight
bfba0dba56 storage: make partial writes pos sanity-check more robust
The return value of f.write and f.seek cannot be compared when using open() in text mode:
```
>>> import os
>>> s = "aá"
>>>
>>> with open("a1", "w", encoding='utf-8') as f:
...   a = f.write(s)
...   pos = f.seek(0, os.SEEK_END)
...   print(a, pos)
...
2 3
>>>
>>> with open("a2", "wb") as f:
...   a = f.write(s.encode('utf-8'))
...   pos = f.seek(0, os.SEEK_END)
...   print(a, pos)
...
3 3
```

Was getting errors on Windows, probably due to `\r\n` vs `\n`?
```
20231010T121334.522573Z |    ERROR | util.CallbackManager | cb errored. event='adb_set_up_to_date'. exc=AssertionError((2471475, 2522998))
Traceback (most recent call last):
  File "...\electrum\electrum\wallet.py", line 497, in on_event_adb_set_up_to_date
    self.save_db()
  File "...\electrum\electrum\wallet.py", line 403, in save_db
    self.db.write()
  File "...\electrum\electrum\json_db.py", line 48, in wrapper
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\json_db.py", line 389, in write
    self._append_pending_changes()
  File "...\electrum\electrum\json_db.py", line 48, in wrapper
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\json_db.py", line 400, in _append_pending_changes
    self.storage.append(s)
  File "...\electrum\electrum\storage.py", line 110, in append
    assert pos == self.pos, (self.pos, pos)
AssertionError: (2471475, 2522998)
```
2023-10-10 14:33:22 +00:00
SomberNight
63143307f1 config: follow-up rename of FEE_EST_STATIC_FEERATE
follow-up 455167136d
2023-10-10 12:11:45 +00:00
ThomasV
57c9059cab open_channel_with_peer: return funding tx
(this makes things easier the just_in_time_channels branch)
2023-10-09 17:02:19 +02:00
ThomasV
2f8325ca09 follow-up 455167136d (variable rename) 2023-10-09 12:31:23 +02:00
ThomasV
f6bebec0a5 follow-up prev commit (variable rename) 2023-10-09 12:19:23 +02:00
ThomasV
455167136d CLI: new getfeerate/setfeerate API 2023-10-09 12:14:39 +02:00
ThomasV
e2fb928e4f delete htlc session keys once they are no longer needed.
fixes #8630

Note: maybe we should plan a WalletDB upgrade to cleanup
existing wallets.
2023-10-08 15:52:41 +02:00
ThomasV
4e76ed6952 move INITIAL_TRAMPOLINE_FEE_LEVEL to config 2023-10-08 15:06:19 +02:00
ThomasV
8acb5dd7e9 CI: run unit tests in debug mode with python 3.11
Python 3.12 does not work with current aiohttp, see
https://github.com/aio-libs/aiohttp/issues/7229

It is currently possible to build a wheel using aiohttp==3.9.0b0.
However, unit tests fail in that case, because TestLNTransport::test_loop stalls.
2023-10-08 11:43:55 +02:00
ThomasV
3249e924d4 follow-up previous commit 2023-10-08 10:39:42 +02:00
ThomasV
2e52b17a43 CLI: replace the 'unlock' command with an option passed to load_wallet
Some use cases require the wallet to be unlocked at load time.
2023-10-08 10:21:01 +02:00
ThomasV
535f7cdcb7 follow-up previous commit 2023-10-07 17:03:13 +02:00
ThomasV
695fe004b0 setconfig: do not return 'true'
not useful (we have type checking) and sometimes confusing
(for example, when you set something to 'false')
2023-10-07 16:51:59 +02:00
ThomasV
16ef287e86 swap server: try to batch funding transactions 2023-10-07 13:26:07 +02:00
Sander van Grieken
cbcafe8960 qml: remove redundant WalletDB, closes #8628 2023-10-06 12:06:00 +02:00
Sander van Grieken
e4f9cfb1cc qt: clipboard might have been changed after show menu. add check. fixes #6526 2023-10-06 11:13:16 +02:00
ThomasV
40eba6f780 submarine swaps: improve labels
- claim tx was incorrectly labeled
 - if we send tx change to a swap, display both labels
2023-10-05 15:41:04 +02:00
Sander van Grieken
9ed5f7bf43 qml: don't show "select server automatically" checkbox in network setup wizard 2023-10-05 11:01:29 +02:00
ThomasV
6de40321c5 rbf batching: make sure new feerate > old feerate
The previous lower bound did not ensure that, sometimes
resulting in tx rejection. Note, though, that BIP125 does
not explicitly state that the new feerate must be strictly
higher than the old feerate.
2023-10-04 11:57:26 +02:00
Sander van Grieken
f7bf4e146d payment_identifier: move adding openalias to contacts out of _do_resolve.
This fixes "cannot pickle '_thread.RLock' object" when paying from Contacts tab
2023-10-03 11:42:12 +02:00
Sander van Grieken
1ea1a70099 partial-writes: add missing package pins 2023-10-02 14:11:23 +02:00
Sander van Grieken
67b0fa2047 qml: add extra parent_fee check. fixes #8634 2023-10-02 09:29:46 +02:00
Sander van Grieken
b12c3233e5 qml: followup 5acfe418079dbc9935cf9576e50ae2c8c841e301; don't save expiry Never as default. 2023-09-30 14:45:42 +02:00
Sander van Grieken
b8b5dab68a qml: properly return when current wallet is selected from wallets list 2023-09-30 14:43:11 +02:00
ThomasV
5acfe41807 qml: add never-expiring requests. fixes #8631 2023-09-30 09:46:16 +02:00
ThomasV
9ebae958dc text gui: fix WalletDB 2023-09-30 09:34:34 +02:00
Alef Farah
cf4590bee3 fix recv for text gui 2023-09-29 17:35:42 -03:00