Skip to content

lnpeer/lnworker: check dont_settle_htlcs when forwarding#10364

Merged
SomberNight merged 4 commits intospesmilo:masterfrom
f321x:test_dont_settle_htlcs_forwarding
Dec 30, 2025
Merged

lnpeer/lnworker: check dont_settle_htlcs when forwarding#10364
SomberNight merged 4 commits intospesmilo:masterfrom
f321x:test_dont_settle_htlcs_forwarding

Conversation

@f321x
Copy link
Copy Markdown
Member

@f321x f321x commented Dec 15, 2025

Adds a check to LNPeer._check_final_mpp_set_state() to not release the preimage of a forwarded htlc if the payment hash is still in LNWallet.dont_settle_htlcs.

Stops removing payment hashes from LNWallet.dont_settle_htlcs and LNWallet.dont_expire_htlcs in Peer._fail_htlc_set() as it can happen that htlcs get failed and we receive another mpp set with the same payment hash which should still not be settled/expired.

Adds the forwarding case to the lnpeer unittests and consolidates the unittest with the existing TestPeerDirect.test_dont_settle_htlcs.

If a payment hash is in LNWallet.dont_settle_htlcs the preimage
shouldn't be released even when just forwarding.
Don't remove a payment hash from LNWallet.dont_settle_htlcs and
dont_expire_htlcs if we are failing it.
We might see another htlc with the same payment hash and
should still not settle or expire it.
The new test
TestPeerForwarding::test_dont_settle_htlcs_receiver_and_forwarder covers
the receiver as well as the forwarder. So this unittest becomes obsolete
as it only tests the receiver.
Copy link
Copy Markdown
Member

@SomberNight SomberNight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you!

@SomberNight SomberNight merged commit bdcd3f9 into spesmilo:master Dec 30, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants