1
0
Commit Graph

19532 Commits

Author SHA1 Message Date
f321x
196cc33c1c ln: fix race when doing concurrent ln payments
There is a race when initiating multiple lightning payments concurrently
(e.g. when doing a reverse swap with prepayment + swap payment).
suggest_splits might overallocate
split amounts for a channel as the splitting of both invoice amounts runs
concurrently and before acutal htlcs that reduce the channels balance
have been added to the channel yet. This results in a "not
enough balance" PaymentFailure once we try to send the htlcs and the
other payment attempt already reduced the available balance of the
channel.

This fix takes a lock from splitting the amount until the htlcs are
put on the channel, so suggest_splits always acts on the correct channel
balance.
2025-11-27 16:43:40 +01:00
ghost43
10fc366688 Merge pull request #10326 from accumulator/fix_10324
run_electrum: proxy command line option implies proxy enabled
2025-11-27 15:24:27 +00:00
Sander van Grieken
3a9e3848e8 run_electrum: proxy command line option implies proxy enabled (fixes #10324) 2025-11-27 16:10:32 +01:00
Sander van Grieken
c519083b9b qml: show lightning invoice amounts with msat precision, allow msat precision entry for no-amount lightning invoices 2025-11-27 12:38:57 +01:00
Sander van Grieken
e137c888a1 qeconfig: fix btc amount regex, add msat regex property, add regex tests 2025-11-27 12:38:49 +01:00
Sander van Grieken
93c9dd9d12 qml: refactor invoice amount checks, msat precision for lightning.
add qeconfig unit tests for conversion methods.
2025-11-27 12:38:49 +01:00
Sander van Grieken
0f2a41e078 simple_config: factor out self.decimal_point and self.get_decimal_point() in favor of self.BTC_AMOUNTS_DECIMAL_POINT 2025-11-27 12:38:49 +01:00
ThomasV
c8dc4a557c Merge pull request #10303 from f321x/submarine_payment_func
swaps/qt: expose swaps to external address
2025-11-27 11:39:09 +01:00
f321x
3b80795e9c qt: move pubkey_to_q_icon in qt.util
Move the pubkey_to_q_icon utility function from qt.swap_dialog in
qt.util.
2025-11-27 11:31:10 +01:00
f321x
8a70fdcb81 qt: expose swaps to address as Submarine Payments
Exposes reverse submarine swaps to an external/specific address in the
TxEditor gui as "Submarine Payments". The user can enter a onchain
address in the Send Tab and then pay it from the lightning balance in
the send tab by enabling the Submarine Payments option in the TxEditor
dialog menu and switching to the Submarine Payment tab in the Tab bar.
2025-11-27 11:17:53 +01:00
ThomasV
9f50d2a61d Merge pull request #10276 from f321x/2fa_conf_qt
trustedcoin: qt: set higher minimumHeight for QR component
2025-11-27 10:39:42 +01:00
f321x
a0455f8382 swaps: allow reverse swaps to external address
Implement logic to claim a reverse swap funding output to any given
address. This allows to do onchain payments to external recipients
through a submarine swap.
2025-11-27 09:50:04 +01:00
SomberNight
d7bc617034 lnonion: add OnionFailureCode.from_int() helper 2025-11-26 17:17:59 +00:00
Sander van Grieken
30f2bc9eb8 lnonion: work around immutability of OnionHopsDataSingle 2025-11-25 15:26:34 +01:00
Sander van Grieken
23d5ed87e7 onion_message: move encrypt_onionmsg_tlv_hops_data() to lnonion as encrypt_hops_recipient_data()
and add support payloads other than onionmsg_tlv
2025-11-25 15:15:12 +01:00
f321x
a6e103b63c lnonion:
add helper properties
 minor refactoring
2025-11-25 13:14:57 +01:00
f321x
c65ec6b2b9 add helper method: run_htlc_switch_iteration
no code modification, indent-only
2025-11-25 13:14:46 +01:00
ThomasV
d36b753cfe remove plugin payserver (moved to spesmilo/electrum-payserver) 2025-11-25 11:40:25 +01:00
ghost43
530260638a Merge pull request #10317 from f321x/fix_payto
cli: payto: fix feerate parsing
2025-11-21 18:37:08 +00:00
ghost43
dabf5bb183 Merge pull request #10316 from SomberNight/202511_trampoline_recursion
lnonion: explicitly forbid nesting trampoline-in-trampoline
2025-11-21 18:19:25 +00:00
SomberNight
4fedab8bba fix tests: follow-up prev 2025-11-21 18:16:59 +00:00
Sander van Grieken
d92b0c74a3 onion_message: num_hops in blinded path is byte, not int. 2025-11-21 17:19:02 +01:00
SomberNight
c288656dc0 trampoline: when sending payment, log "is_legacy" (e2e vs pay2legacy) 2025-11-21 15:45:33 +00:00
f321x
114c48e452 cli: payto: fix feerate parsing
Feerate is passed to `Commands._get_fee_policy()` as str which then
tried to multiply the string by 1000. Now it first casts the string to
`Decimal` and multiplies the decimal.

Fixes https://github.com/spesmilo/electrum/issues/10315
2025-11-19 17:38:58 +01:00
SomberNight
ecd1b7ade8 lnonion: explicitly forbid nesting trampoline-in-trampoline
This assert is needed because I don't want to reason about
what could happen without it.

We currently use fixed 400 bytes trampoline onion sizes, which would
implicitly prevent this. However the current bolts PR actually specifies
variable size trampoline onions.
2025-11-19 16:28:50 +00:00
ThomasV
30d34238e6 Merge pull request #10307 from SomberNight/202511_qml_feehistogram_colours
qml: fee histogram colours: extend colour palette to cover sub-1 s/b
2025-11-19 17:27:48 +01:00
ghost43
d15598bcf0 Merge pull request #10313 from SomberNight/202511_keystore_lrucache
keystore: fix memory leak for LRU cache
2025-11-18 18:25:31 +00:00
SomberNight
c919d4940a keystore: fix memory leak for LRU cache
Using `@functools.lru_cache` on an instance method behaves in interesting ways.
The cache kept a ref around for `self`, so in effect we were never GC-ing keystore objects. Effectively there was a single global cache for derive_pubkey, with keys `(keystore, for_change, n)`.

This PR now changes the caching to be per-keystore:
each ks has a cache, keyed `(for_change, n)`.
GC-ing individual keystores should now be possible, which should result in cleaning up just their own cache.

This also enables the corresponding previously silence flake8-bugbear check for `@functools.lru_cache`. (note that the check can selectively be disabled by adding a comment on the relevant line: `# noqa: B019`)
2025-11-18 17:06:42 +00:00
SomberNight
bdb7a3566f ci: update flake8 2025-11-18 17:02:23 +00:00
ghost43
ee80065bb8 Merge pull request #10312 from SomberNight/202511_pr10230_1
lnonion: immutable OnionPacket and OnionHopsDataSingle
2025-11-18 16:41:19 +00:00
SomberNight
1b600b49e9 lnmsg/lnonion: follow-up prev: "hide" MappingProxyType usage 2025-11-18 14:54:33 +00:00
ghost43
c09b3d2b2a Merge pull request #10311 from SomberNight/202511_tests_mixed_spend
test_wallet_vertical: add case spending mixed segwit/non-segwit UTXOs
2025-11-18 14:01:25 +00:00
SomberNight
e52ed5073e test_wallet_vertical: add case spending mixed segwit/non-segwit UTXOs
I needed such a tx to test something in electrumx and wanted to copy-paste one from the electrum unit tests. Weird that we were lacking such a test case, I was fairly certain there was one already...
2025-11-17 19:20:36 +00:00
SomberNight
e6071bbf5d qml: fee histogram colours: extend colour palette to cover sub-1 s/b
Currently on master the qml fee histogram colours are calculated for feerates clamped to [1, 600] sat/vbyte. I want to extend it to now cover [0, 600] sat/vbyte.
I would like to extend it in a way that does not change the existing colour meanings/mapping, so not just e.g. doing an offset.

follow-up bd6dfc53a2
2025-11-15 01:46:31 +00:00
Sander van Grieken
81c83f8318 qeinvoice: query self.status once in update_userinfo() and determine_can_pay() 2025-11-13 12:40:37 +01:00
ThomasV
5cb0902793 Merge pull request #10299 from f321x/pay_to_many_label
qt: send tab: show "pay to many" label
2025-11-12 15:29:27 +01:00
SomberNight
5a14a585db scripts: add README
closes https://github.com/spesmilo/electrum/issues/10291
2025-11-11 16:51:31 +00:00
ghost43
e971e6274d Merge pull request #10305 from SomberNight/202511_lnrouter_copypaste
lnrouter: LiquidityHint: fix logic bug in calculation
2025-11-11 16:29:34 +00:00
SomberNight
6332a3a6a8 lnrouter: LiquidityHint: fix logic bug in calculation
Reported privately by Zuzana Kotásková <36777@mail.vsfs.cz>
2025-11-11 16:00:41 +00:00
f321x
936e7fd1c2 lnonion: immutable OnionPacket and OnionHopsDataSingle
Make OnionHopsDataSingle and OnionPacket immutable for safer caching and
handling.

# Conflicts:
#	electrum/onion_message.py
2025-11-11 14:37:37 +01:00
Sander van Grieken
1ad6607405 onion_message: fix handling of ONION_MESSAGE_LARGE_SIZE payload sizes for onion messages,
process dummy hops regardless of EXPERIMENTAL_LN_FORWARD_PAYMENTS config option.
2025-11-10 16:20:15 +01:00
Sander van Grieken
3cb639f9b4 onion_message: ensure blinded path is list 2025-11-10 15:02:37 +01:00
Sander van Grieken
9481f4f636 followup prev 2025-11-10 13:50:38 +01:00
Sander van Grieken
130af59760 update field naming for BOLT04 structures
see also: 3fffab3b88
2025-11-10 13:47:20 +01:00
ghost43
d87f9e9a44 Merge pull request #10295 from SomberNight/202510_proto16
electrum protocol: add support for 1.6, but keep supporting 1.4
2025-11-07 16:42:11 +00:00
ghost43
7cb5621625 Merge pull request #10274 from f321x/lnpay_collect_failed_htlcs
lnworker: collect failed htlcs during payment attempt, fix todo
2025-11-07 16:17:19 +00:00
SomberNight
e53666ac86 lnworker: follow-up prev: split pay_to_node 2025-11-07 15:37:49 +00:00
ThomasV
359af667d3 Merge pull request #10233 from spesmilo/jsondb_pointers
Jsondb pointers
2025-11-07 10:21:27 +01:00
ThomasV
077bcf515d StoredDict: use pointers instead of path
Instead of storing its own path, each StoredDict element stores
its own key and a pointer to its parent. If a dict is removed
from the db, its parent pointer is set to None. This makes
self.path return None for all branches that have been pruned.

This passes tests/tests_json_db.py and fixes issue #10000
2025-11-07 10:00:10 +01:00
ThomasV
53c1817956 tests/test_jsondb.py: add tests that replace a StoredDict element
after its parent has been removed.

Related: #10000
2025-11-07 10:00:10 +01:00