Blockstream/greenlight

track: Waiting forever to sweep HTLC timeout transactions

cdecker opened this issue · 1 comments

This is tracking an upstream issue in CLN. It appears that we have an integer underrun when computing the time until an HTLC timeout should be swept.

Quoting from the original report #438

The cause appears to be the outgoing HTLC hitting its deadline, thus causing the channel to close:

2024-04-08T21:13:56+02:00 {} stdout: DEBUG   0264a62a4307d701c04a46994ce5f5323b1ca28c80c66b73c631dbcb0990d6e835-onchaind-chan#1: billboard perm: Tracking our own unilateral close
....`
2024-04-08T21:13:56+02:00 {} stdout: DEBUG   0264a62a4307d701c04a46994ce5f5323b1ca28c80c66b73c631dbcb0990d6e835-onchaind-chan#1: Resolved FUNDING_TRANSACTION/FUNDING_OUTPUT by OUR_UNILATERAL (463972904772472b38fa1cc907e5143a5af1a008cb373179c22f4d824d72e11f)
...
2024-04-08T21:13:56+02:00 {} stdout: DEBUG   0264a62a4307d701c04a46994ce5f5323b1ca28c80c66b73c631dbcb0990d6e835-onchaind-chan#1: Telling lightningd about OUR_HTLC_TIMEOUT_TX to resolve OUR_UNILATERAL/OUR_HTLC after block 835914 (-65 more blocks)
...
2024-04-08T21:13:56+02:00 {} stdout: UNUSUAL 0264a62a4307d701c04a46994ce5f5323b1ca28c80c66b73c631dbcb0990d6e835-chan#1: We want to bump HTLC fee, but no funds!

Output 4 is the delayed return to us by the way:

2024-04-08T21:13:57+02:00 {} stdout: DEBUG   0264a62a4307d701c04a46994ce5f5323b1ca28c80c66b73c631dbcb0990d6e835-onchaind-chan#1: Tracking output 463972904772472b38fa1cc907e5143a5af1a008cb373179c22f4d824d72e11f:4: OUR_UNILATERAL/DELAYED_OUTPUT_TO_US

And it looks like we have some sort of integer underrun:

2024-04-08T21:13:57+02:00 {} stdout: DEBUG   0264a62a4307d701c04a46994ce5f5323b1ca28c80c66b73c631dbcb0990d6e835-onchaind-chan#1: billboard: 6 outputs unresolved: in 4294967232 blocks will spend OUR_HTLC (463972904772472b38fa1cc907e5143a5af1a008cb373179c22f4d824d72e11f:2) using OUR_HTLC_TIMEOUT_TX

Interesting how that 65 blocks became UINT32_MAX - 2^6, that might be the real reason for this issue here.

Tracks:

Tracking in the CLN repo: ElementsProject/lightning#7305

We have a prospective fix with ElementsProject/lightning#7343. We will review the patch, merge it, and verify it's working. That will take a bit of time, but its good to have a fix on its way :-)