1
0
Commit Graph

19695 Commits

Author SHA1 Message Date
SomberNight
6d1e8e8619 lnworker: write rationale for PaymentInfo class in docstring
ref 4ad9caddab
ref f08e5541ae
2025-12-08 15:54:37 +00:00
ThomasV
4d3ead36c9 Merge pull request #10348 from f321x/fix_jit_channel_openings_regtest
lnpeer: deduct jit channel fees from total amount
2025-12-06 11:11:42 +01:00
ThomasV
da998150ac lnpeer: deduct JIT fees also for trampoline 2025-12-06 10:33:24 +01:00
f321x
fb566eb59e lnpeer: deduct jit channel fees from total amount
Deduct the just in time channel opening fees from the total amount so
htlcs don't get timed out if they come from a just in time channel with
opening fee.

Related: https://github.com/spesmilo/electrum/pull/9584
2025-12-06 10:14:07 +01:00
ghost43
f8fc2b63e3 Merge pull request #10271 from f321x/fix_save_payment_info
lightning: fix self payments (e.g. rebalance)
2025-12-05 17:19:39 +00:00
ghost43
07b59631bf Merge pull request #10349 from SomberNight/202512_openalias
openalias: always require DNSSEC validation, and fix a qml regression
2025-12-05 17:09:19 +00:00
SomberNight
cf8c243bd9 dnssec: log warning if dependency is missing
Calling dnssec.query() with missing "cryptography" dep behaves the same as if DNSSEC validation failed: validated=False will be returned.
When used for openalias, we mandate validated=True.
2025-12-05 17:06:50 +00:00
SomberNight
cdcac8cb09 openalias: always enforce DNSSEC validation succeeds 2025-12-05 17:06:41 +00:00
Sander van Grieken
23b6465780 onion_message: verify ONION_MESSAGE feature on peer before forwarding 2025-12-05 17:53:03 +01:00
Sander van Grieken
fb58d210e5 onion_message: fix forwarding, blinding was renamed path_key
followup 130af59760
2025-12-05 17:51:19 +01:00
SomberNight
49430e9722 qml: fix: paying to openalias
regression from in https://github.com/spesmilo/electrum/pull/9993
    7d0ac64d06
2025-12-05 16:12:04 +00:00
ghost43
f3dccc8e4b Merge pull request #10347 from accumulator/gossip_cln_feature_workaround
electrum refuses to exchange gossip with CLN nodes, due to missing feature OPTION_CHANNEL_TYPE_OPT
2025-12-05 15:18:55 +00:00
Sander van Grieken
3e4f80aa06 electrum refuses to exchange gossip with CLN nodes, due to missing feature OPTION_CHANNEL_TYPE_OPT.
moving OPTIONAL_CHANNEL_TYPE_OPT to BASE_FEATURES
2025-12-05 15:51:16 +01:00
ThomasV
55cc27d27e Test JIT channels: check that lnpay success is true.
This test fails since 0f314d1dd9
2025-12-05 12:05:37 +01:00
ThomasV
cd1d384db5 lnwatcher: remove address callback if keep_watching is False
(follow-up 9b72dc297b)
2025-12-05 11:53:24 +01:00
ThomasV
40729aa0e5 test accounting_addresses: stop alice before requesting, because we need a new session.
(follow-up 9b72dc297b)
2025-12-05 11:31:27 +01:00
SomberNight
ef0e4e02b7 txbatcher: add TODOs re nLocktime block-height vs timestamp confusion
seems harmless atm but some rethinking is needed and checks should be added
2025-12-04 15:32:46 +00:00
ghost43
1eb69c90dd Merge pull request #10341 from SomberNight/202512_nwc_dontmutateevent
plugins: nwc: don't mutate aionostr Event
2025-12-04 15:24:40 +00:00
ThomasV
9b72dc297b lnwatcher: remove rearly return that breaks accounting_addresses
This reverts 6ffaa55.
Also, in regtests, add a check that fails if accounting_addresses are broken.
2025-12-04 10:26:01 +01:00
SomberNight
75ac8bcee1 plugins: nwc: don't mutate aionostr Event
I want to change the Event class to be immutable.
2025-12-04 00:47:32 +00:00
ThomasV
32c677bed0 Qt wizard: bugfix: standardize_path in WCWalletName
without this, any wallet that is not in the config
wallet_path cannot be open.
2025-12-03 11:45:51 +01:00
ThomasV
cb7e550abb follow-up prev commit 2025-12-02 10:38:10 +01:00
SomberNight
14fd85f935 json_db: fix StoredDict.__delitem__() to work similarly to .pop()
follow-up https://github.com/spesmilo/electrum/pull/10233 ("jsondb pointers")
2025-12-01 19:42:47 +00:00
SomberNight
afc87fea9a tests: json_db: add more asserts for clarity 2025-12-01 19:33:14 +00:00
SomberNight
1119cb9a75 json_db: add some type hints and asserts
- fix some incorrect type hints
- add many new type hints
- add asserts re types

no functional changes intended
2025-12-01 19:29:51 +00:00
f321x
df612fa010 lnworker: allow overwriting amount of sent payment info
Allows replacing a saved `PaymentInfo` of `SENT` direction if the old
one is not yet paid.
This allows the user to retry paying a 0 amount invoice with different
amount if the previous attempt failed.
2025-12-01 18:39:59 +01:00
f321x
923d48f9db lnworker: differentiate PaymentInfo by direction
Allows storing two different payment info of the same payment hash by
including the direction into the db key.
We create and store PaymentInfo for sending attempts and for requests (receiving),
if we try to pay ourself (e.g. through a channel rebalance) the checks
in `save_payment_info` would prevent this and throw an exception.
By storing the PaymentInfos of outgoing and incoming payments separately in
the db this collision is avoided and it makes it easier to reason about
which PaymentInfo belongs where.
2025-12-01 18:39:56 +01:00
SomberNight
828fc569c9 commands: version_info: include openssl version 2025-11-30 06:03:08 +00:00
ghost43
d17bb016ef Merge pull request #10330 from SomberNight/202511_lnsweep_refactor_preimage
lnsweep: factor out "maybe_reveal_preimage_for_htlc"
2025-11-28 16:57:05 +00:00
SomberNight
ef8fd03e8f lnsweep: factor out "maybe_reveal_preimage_for_htlc"
no functional changes
2025-11-28 15:55:35 +00:00
ghost43
125b7ee0d7 Merge pull request #10319 from f321x/fix_lightning_num_sats_can_send
lnworker: use config lightning fee for estimate
2025-11-28 15:35:05 +00:00
f321x
c575abc8e2 qt: update tabs on exit of SettingsDialog
Update the tabs after the SettingsDialog gets closed, some values might
have to be updated according to the new configuration.
2025-11-28 16:25:39 +01:00
f321x
af4dc24d87 lnworker: use config lightning fee for estimate
I was unable to do a "Max" amount submarine swap because the
`fee_estimate` method used by `LNWallet.num_sats_can_send()` uses a
hardcoded `fee_proportional_millionths` to estimate the fee for the
lightning payment.
When the actual fee determined later is higher
than the estimated fee the payment fails as the channel is unable to add
the htlc sum including the real fees as the amount exceeds the balance of
the channel.
Using the fees the maximum fees user has configured and estimate the
potential fee as inverse of PaymentFeeBudget is more
reliable/conservative as we definitely aren't going to pay more fees
than this amount.
2025-11-28 16:25:34 +01:00
ThomasV
bcbc1b4e6e Merge pull request #10328 from f321x/improve_lnfee_slider
qt: SettingsDialog: update ln fee config on slider moved
2025-11-28 14:06:13 +01:00
ThomasV
128026a442 SwapProvidersButton class
factorize code that is used in both SwapDialog and Submarine payments
2025-11-28 13:31:14 +01:00
ThomasV
8bec3eafd2 swaps dialog: in callbacks, update either send or receive field, depending on which one follows
before this, the content of the non-following field could be modified by callbacks
2025-11-28 10:49:23 +01:00
f321x
088f273d9b qt: SettingsDialog: update ln fee config on slider moved
When moving the lightning fee slider in the SettingsDialog by clicking
on the range instead of pulling the slider the new fee value wouldn't
get stored in the config as the sliderRelased signal is only emitted
when the slider is pulled.
This change updates it on valueChanged.
2025-11-28 09:55:32 +01:00
ghost43
3f45c41981 Merge pull request #10230 from f321x/refactor_htlc_handling
lightning: refactor htlc switch
2025-11-27 17:26:53 +00:00
ghost43
09af77872f Merge pull request #10327 from f321x/followup_10303
swaps: followup 10303
2025-11-27 17:25:22 +00:00
f321x
59586d6f94 tests: lnpeer: add test_payment_with_malformed_onion
Adds a simple forwarding test where the receiver fails a malformed onion with
`update_fail_malformed_htlc`.
2025-11-27 17:58:51 +01:00
f321x
16ed7e666c lnpeer: use INVALID_ONION_VERSION for unparsable onions
Use the `OnionFailureCode.INVALID_ONION_VERSION` (BADONION | PERM | 4)
code when sending back `update_fail_malformed_htlc` as just sending a plain
`BADONION` is not explicitly mentioned as correct in the spec.
2025-11-27 17:58:49 +01:00
f321x
1fd5458b0e tests: lnpeer: test_dont_expire_htlcs
Adds unittest to test the dont_expire_htlcs logic
2025-11-27 17:58:47 +01:00
f321x
4f2e1b65f0 tests: test_lnpeer: add test_dont_settle_htlcs
Adds test for the dont_settle_htlcs functionality of lnworker used by
Just-In-Time channels.
2025-11-27 17:58:46 +01:00
f321x
abc469c846 lnworker: split dont_settle_htlcs
Splits `LNWallet.dont_settle_htlcs` into `LNWallet.dont_settle_htlcs`
and `LNWallet.dont_expire_htlcs`.

Registering a payment hash in dont_settle_htlcs will prevent it from
getting fulfilled if we have the preimage stored. The preimage will not
be released before the the payment hash gets removed from
dont_settle_htlcs. Htlcs can still get expired as usual or failed if no
preimage is known.
This is only used by Just-in-time channel openings.

Registering a payment hash in dont_expire_htlcs allows to overwrite the
minimum final cltv delta value after which htlcs would usually get
expired. This allows to delay expiry of htlcs or, if the value in the
dont_settle_htlcs dict is None, completely prevent expiry and let the
htlc get expired onchain.

Splitting this up in two different dicts makes it more explicit and
easier to reason about what they are actually doing.

 Please enter the commit message for your changes. Lines starting
2025-11-27 17:58:44 +01:00
f321x
b1e58450bd tests: test_lnpeer: add test_payment_bundle_with_hold_invoice
Adds test_payment_bundle_with_hold_invoice to simulate the use of a
payment bundle in which one invoice of the bundle needs to trigger a hold invoice
callback (similar to submarine swaps).
Also modifies the test helper _test_simple_payment() to compare the
results of all payment attempts instead of just returning after the
first (of multiple) payments raises its result causing the test to miss
if all payments were successful or not.
2025-11-27 17:58:43 +01:00
f321x
95729a08ef lnpeer: report htlc_switch exceptions to crash reporter
It seems useful to report exceptions happening in the htlc_switch to the
crash reporter as it shouldn't raise exceptions in theory and this could
help catch subtle bugs.
2025-11-27 17:58:41 +01:00
f321x
042557da9b tests: test_lnpeer: test_htlc_switch_iteration_benchmark
Benchmark how long a call to _run_htlc_switch_iteration takes with 10
trampoline mpp sets of 1 htlc each.
2025-11-27 17:58:40 +01:00
f321x
f56b13b610 tests: test_lnpeer: test_hold_invoice_set_doesnt_get_exp
Add test `test_hold_invoice_set_doesnt_get_expired` to test_lnpeer to
ensure a mpp set on which a hold invoice callback doesn't get expired
automatically if the cltv_abs falls below MIN_FINAL_CLTV_DELTA_ACCEPTED
as these sets should only get failed if the htlcs are safe to fail by
the target of the hold invoice callback (e.g. swap got refunded
successfully).
2025-11-27 17:58:38 +01:00
f321x
bb828097b3 tests: test_lnpeer: test compare trampoline onions
Adds test_forwarder_fails_for_inconsistent_trampoline_onions
which checks that a forwarder compares the trampoline onions of a mpp
set and fails the set if the onions are not similar.
In the test alice sends a mpp through bob with 2 htlcs, in one
trampoline onion amt_to_forward is off by 1 msat so bob fails the htlc
set instead of initiating the trampoline forwarding.
2025-11-27 17:58:34 +01:00
f321x
447d91d7b6 tests: lnpeer: test_trampoline_mpp_consolidation_forwarding_amount
Add sanity check that bob is not forwarding more sats to carol if than
he receives from alice. (he only forwards once and doesn't try to
forward multiple times).
This should get caught by asserts in lnworker/lnpeer, nevertheless it
seems to make sense to just add this test to prevent regressions of this
kind.
2025-11-27 17:57:26 +01:00