Skip to content

Add mechanism to block htlcs from settling back#9586

Merged
ecdsa merged 1 commit intospesmilo:masterfrom
f321x:jit-block-preimage
Mar 7, 2025
Merged

Add mechanism to block htlcs from settling back#9586
ecdsa merged 1 commit intospesmilo:masterfrom
f321x:jit-block-preimage

Conversation

@f321x
Copy link
Copy Markdown
Member

@f321x f321x commented Feb 28, 2025

Required for #9584
Adds a persisted dictionary of htlc keys (= result of serialize_htlc_key()) to lnworker to allow adding htlcs which should not be settled back even if we got the required preimage to do so.
Currently if we open a JIT channel and get the preimage from the client we concurrently settle the incoming htlc to us, however we may still want to fail it in the process of opening the JIT channel which is not finished yet, for example if we were unable to broadcast the funding tx. With this change we can block the settling until the forwarding callback has returned.
Also fixes a key error exception that happened if the incoming htlc got settled before the callback returned, wrapped_callback then tried to access active_forwardings[payment_key] which has already been removed after settling the incoming htlc.

@f321x f321x force-pushed the jit-block-preimage branch 6 times, most recently from 56a47e5 to 5808bda Compare March 7, 2025 10:00
@ecdsa
Copy link
Copy Markdown
Member

ecdsa commented Mar 7, 2025

note: the key error exception handling was removed from this PR, as it needs to be addressed separately

@f321x f321x force-pushed the jit-block-preimage branch 3 times, most recently from 266b63e to 1777645 Compare March 7, 2025 11:02
@f321x f321x force-pushed the jit-block-preimage branch from 1777645 to 109ad2b Compare March 7, 2025 11:04
@ecdsa ecdsa merged commit 8011ae0 into spesmilo:master Mar 7, 2025
0 of 13 checks passed
@f321x f321x deleted the jit-block-preimage branch March 7, 2025 11:57
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