1
0
Commit Graph

18521 Commits

Author SHA1 Message Date
Sander van Grieken
77407fa206 qml: offer same choices as desktop; Open, Discard, Save to wallet 2025-05-16 10:41:41 +02:00
accumulator
8368469e2c Merge pull request #9832 from accumulator/fix_9829
qml: handle callbacks via ui thread.
2025-05-16 10:23:03 +02:00
Sander van Grieken
c89398cd5b qml: handle callbacks via ui thread. 2025-05-16 09:49:41 +02:00
SomberNight
6320597f2c regtests: rm sleep from "swapserver_forceclose" test
less reliance on timing
(OTOH it hardcodes the output index of the commitment tx... meh)
2025-05-15 19:50:16 +00:00
SomberNight
f3551f3c25 commands: add cmd wait_for_sync 2025-05-15 19:42:34 +00:00
SomberNight
586cf33c05 lnchannel: rm sweep_info cache
- was added when functions in lnsweep returned already signed tx, and signing is expensive
- get_ctx_sweep_info does not presign anymore
- cache invalidation is difficult here
  - e.g. not only on new blocks, but we should e.g. also invalidate the cache when learning new preimages
2025-05-15 19:41:44 +00:00
SomberNight
b1f0c6e353 synchronizer: get_transaction should discard tx_height as it can change
tx_height comes from the `get_history` RPC, we then call the `get_transaction` RPC.
By the time the `get_transaction` RPC returns, we might have received another
scripthash status update, called `get_history` again, and updated height for the txid.
Synchronizer._get_transaction() should not call adb.receive_tx_callback() with
the old tx_height (but it was doing exactly that).

Patch to trigger, e.g. regtest failures:
(e.g. for tests.regtest.TestLightningAB.test_extract_preimage)
```
diff --git a/electrum/interface.py b/electrum/interface.py
index 8649652b9c..fce7a1c6de 100644
--- a/electrum/interface.py
+++ b/electrum/interface.py
@@ -991,6 +991,7 @@ class Interface(Logger):
         return res

     async def get_transaction(self, tx_hash: str, *, timeout=None) -> str:
+        await asyncio.sleep(3)
         if not is_hash256_str(tx_hash):
             raise Exception(f"{repr(tx_hash)} is not a txid")
         raw = await self.session.send_request('blockchain.transaction.get', [tx_hash], timeout=timeout)

```
2025-05-15 19:35:15 +00:00
SomberNight
61283fe18b adb: (trivial) receive_tx_callback: make tx_height param kw-only 2025-05-15 19:09:37 +00:00
ThomasV
626264d24f Merge pull request #9784 from f321x/allow_lnaddress_contacts
qt: allow lightning addresses in contacts
2025-05-15 19:09:48 +02:00
f321x
b6e1e527c2 contacts: support lightning addressses as contact address
lightning addresses are useful and widely adopted, so it should be
possible to save them as payment identifier for a contact.
2025-05-15 17:55:23 +02:00
ThomasV
6500788328 Merge pull request #9710 from f321x/dont_delete_config_on_syntax_error
config: Raise instead of overwriting the config file on syntax error
2025-05-15 17:24:35 +02:00
f321x
8870838834 raise instead of overwriting the config file on syntax error 2025-05-15 17:21:16 +02:00
ghost43
79a54c1578 Merge pull request #9826 from f321x/fix_fee_disagreement_ln
fix: reduce update_fee target for anchor channels
2025-05-15 13:30:11 +00:00
ThomasV
93e7de20e9 Merge pull request #9753 from f321x/debug_ln_payment_failure
ln: don't exclude single part configs for too small payments
2025-05-15 13:25:00 +02:00
f321x
e8171ca7c6 suggest_splits: don't exclude single part configs for too small multi
part configs

I noticed certain ln payments become very unreliable. These payments are ~21k sat, from gossip to gossip sender, with direct, unannounced channel.

Due to the recent fix https://github.com/spesmilo/electrum/pull/9723 `LNPathFinder.get_shortest_path_hops()` will not use channels for the last hop of a route anymore that aren't also passed to it in `my_sending_channels`:

```python
if edge_startnode == nodeA and my_sending_channels:  # payment outgoing, on our channel
    if edge_channel_id not in my_sending_channels:
        continue
```

Conceptually this makes sense as we only want to send through `my_sending_channels`, however if the only channel between us and the receiver is a direct channel that we got from the r_tag and it's not passed in `my_sending_channel` it's not able to construct a route now.

Previously this type of payment worked as `get_shortest_path_hops()` knew of the direct channel between us and `nodeB` from the invoices r_tag and then just used this channel as the route, even though it was (often) not contained in `my_sending_channels`.

`my_sending_channels`, passed in `LNWallet.create_routes_for_payment()` is either a single channel or all our channels, depending on `is_multichan_mpp`:

```python
for sc in split_configurations:
	  is_multichan_mpp = len(sc.config.items()) > 1
```

This causes the unreliable, random behavior as `LNWallet.suggest_splits()` is supposed to `exclude_single_part_payments` if the amount is > `MPP_SPLIT_PART_MINAMT_SAT` (5000 sat).
As `mpp_split.py suggest_splits()` is selecting channels randomly, and then removes single part configs, it sometimes doesn't return a single configuration, as it removes single part splits, and also removes multi part splits if a part is below 10 000 sat:

```python
if target_parts > 1 and config.is_any_amount_smaller_than_min_part_size():
    continue
```

This will result in a fallback to allow single part payments:

```python
split_configurations = get_splits()
if not split_configurations and exclude_single_part_payments:
    exclude_single_part_payments = False
    split_configurations = get_splits()
```

Then the payment works as all our channels are passed as `my_sending_channels` to  `LNWallet.create_routes_for_payment()`.

However sometimes this fallback doesn't happen, because a few mpp configurations found in the first iteration of `suggest_splits` have been kept, e.g. [10500, 10500], but at the same time most others have been removed as they crossed the limit, e.g. [11001, 9999], (which happens sometimes with payments ~20k sat), this makes `suggest_splits` return very few usable channels/configurations (sometimes just one or two, even with way more available channels).
This makes payments in this range unreliable as we do not retry to generate new split configurations if the following path finding fails with `NoPathFound()`, and there is no single part configuration that allows the path finding to access all channels. Also this does not only affect direct channel payments, but all gossip payments in this amount range.

There seem to be multiple ways to fix this, i think one simple approach is to just disable `exclude_single_part_payments` if the splitting loop already begins to sort out configs on the second iteration (the first split), as this indicates that the amount may be too small to split within the given limits, and prevents the issue of having only few valid splits returned and not going into the fallback. However this also results in increased usage of single part payments.
2025-05-15 10:26:33 +02:00
ThomasV
33ea89c94b Merge pull request #9793 from accumulator/psbt_nostr_send_description
PSBT nostr, send invoice/tx description along with PSBT
2025-05-15 09:44:55 +02:00
ThomasV
926e20be9c Merge pull request #9825 from accumulator/qt_no_request_details_when_multiple_selected
qt: don't show request details when multiple requests are selected in…
2025-05-15 09:32:43 +02:00
f321x
61874e9fe7 fix: reduce update_fee target for anchor channels
the update_fee logic for lightning channels was not adapted to anchor
channels causing us to send update_fee with a eta target of 2 blocks.
This causes force closes when there are mempool spikes as the fees we
try to update to are a lot higher than e.g. eclair uses. Eclair will
force close if our fee is 10x > than their fee.
2025-05-14 18:01:44 +02:00
SomberNight
6c11c75d58 follow-up prev 2025-05-14 13:29:30 +00:00
SomberNight
44f3444795 lnworker: make "preimages" dict private
I want to hook into lnworker.save_preimage (not done yet).
Other modules should not put preimages into the dict directly.
2025-05-14 13:23:02 +00:00
Sander van Grieken
4c88836389 qt: don't show request details when multiple requests are selected in request_list 2025-05-14 14:45:14 +02:00
ThomasV
37352ea5a9 Merge pull request #9823 from f321x/psbt_nostr_verify_authors
fix: verify author pubkey of psbt nostr events
2025-05-14 13:12:25 +02:00
Sander van Grieken
a9213c4d66 psbt_nostr: send label along with PSBT 2025-05-14 12:49:33 +02:00
Sander van Grieken
6566f2f0a4 qt: pass Invoice object to transaction dialog when appropriate.
This is purely informational and optional, with the main immediate use to provide the
invoice description/message/label to the transaction dialog, so it can be stored
when saving the tx in history, or passed along with PSBTs sent to cosigners.

Before, the tx description was not saved in history when an invoice was not saved before
signing and saving the tx for sending later.
2025-05-14 12:49:33 +02:00
Sander van Grieken
f535817006 psbt_nostr: qml: don't let iterator overwrite param 2025-05-14 12:48:47 +02:00
f321x
759022d3ff fix: verify author pubkey of psbt nostr events
Checks if the pubkey of the author sending the psbt cosigning
request is in our list of cosigner pubkeys to prevent accepting
"fake" requests from other pubkeys.
2025-05-14 11:28:11 +02:00
SomberNight
1b031d432e qt tx dialog: allow clicking into the future. wheeee
- "outpoints" for inputs were already clickable to open the funding tx
- now "outpoints" for outputs are also clickable to open the spending tx
2025-05-13 18:30:20 +00:00
accumulator
2947de23da Merge pull request #9820 from f321x/qml_terms_of_use
qml: add terms of use to setup wizard
2025-05-13 15:54:34 +02:00
f321x
adaafeaae1 disable proxy checkbox in ProxyConfig by default
disable the checkbox by default, so that if a user selects Enable Proxy
in the advanced network settings, and then just clicks next with the proxy
checkbox set, doesn't end up with a invalid proxy configuration which
doesn't connect to the server and has to be fixed manually.
2025-05-13 14:28:22 +02:00
f321x
38f51a3b13 qml: add terms of use to setup wizard 2025-05-13 14:28:13 +02:00
ThomasV
6d939a0ee6 add LIGHTNING_MAX_HTLC_VALUE_IN_FLIGHT_MSAT to config
This allows to reproduce #9700 using two electrum instances
2025-05-13 13:07:00 +02:00
ThomasV
aff7243f06 qt wizard server_connect tweaks 2025-05-13 13:05:17 +02:00
ThomasV
b1623431aa Merge pull request #9821 from f321x/qt_network_tab_move_sentence
followup: qt terms of use, move label in network tab
2025-05-13 12:53:58 +02:00
f321x
e9a1357a99 followup: qt terms of use, move label in network tab
moves 2nd sentence in network tab below the checkboxes and adds a bit of
spacing below the electrum logo in the Terms of Use tab.
2025-05-13 12:12:15 +02:00
ThomasV
660ffa2b8f fix test_txbatcher (follow-up 6e3f173a71) 2025-05-13 09:09:35 +02:00
ThomasV
6e3f173a71 SweepInfo: define csv_delay as property 2025-05-13 08:50:33 +02:00
ThomasV
0607a406ce Qt: add closing warning if we have an unconfirmed local commitment tx with htlcs
add htlc direction (offered, received) to the htlc sweep_info name
regtest: add test_reedeem_received_htlcs
2025-05-12 15:48:20 +02:00
ThomasV
7d6c21f233 txbatcher: fix wanted_height shown in GUI
if an input has both CSV and CLTV, we must display the highest value
2025-05-12 13:46:27 +02:00
ThomasV
8c31ed648a simplify default label of tx 2025-05-12 13:46:27 +02:00
ThomasV
a1db855c63 Merge pull request #9819 from f321x/fix_tui_crash
fix: text gui exceptions and and type errors
2025-05-12 13:18:13 +02:00
ThomasV
148518a1f2 txbatcher: sanity check csv_delay
follow-up 8319a855a9
2025-05-12 13:04:30 +02:00
ThomasV
8319a855a9 fix csv_delay for htlcs in sweep_our_ctx 2025-05-12 12:38:07 +02:00
f321x
5bfddad67c use daemon.load_wallet instead of constructing manually 2025-05-12 10:53:12 +02:00
f321x
6e21dac387 fix: tui contacts edit label and delete button
the edit label button did crash the application because get_string
returned bytes instead of a string. The delete button was not
implemented but shown in the tui.
2025-05-12 10:51:19 +02:00
ThomasV
e54d57bf73 Qt: improve closing warnings for submarine swaps 2025-05-12 10:21:46 +02:00
f321x
bfe895fc3e remove unused imports, fix type hint 2025-05-12 10:17:30 +02:00
f321x
b0fd126e1b fix: exception if payment amount is not set
if payment amount is not set and the user tried to pay, the application
would crash. This shows a message instead. Also uses show_message
instead of show_error, as show_error doesn't exist.
2025-05-12 10:08:52 +02:00
f321x
02232b227e fix IndexError if self.channel_ids is empty 2025-05-12 10:00:38 +02:00
accumulator
05e395018c Merge pull request #9782 from f321x/fix_qr_input_from_file
qt: add qr reading from file to ScanQRTextEdit and SendTab
2025-05-09 11:50:04 +02:00
SomberNight
351cc6abd9 Revert "interface: add padding and some noise to protocol messages"
Unforeseen issues. Needs more work..

This reverts commit 097eabed1f.
2025-05-08 18:34:07 +00:00