Blockstream / greenlight

Build apps using self-custodial lightning nodes in the cloud
https://blockstream.github.io/greenlight/getting-started/
MIT License
109 stars 27 forks source link

Htlcs expired long time ago and payment still pending #485

Open roeierez opened 1 month ago

roeierez commented 1 month ago
flowchart LR
  bsr[BSR#83] <--> glp[GLP#485]
  click glp href "https://github.com/Blockstream/greenlight/issues/485"
  click bsr href "https://github.com/breez/breez-sdk-relai/issues/83"

Relai issue: https://github.com/breez/breez-sdk-relai/issues/83

I see two inflight htlcs that have been expired a long time ago and the channel is still opened:

htlcs: [ListpeerchannelsChannelsHtlcs { direction: Some(Out), id: Some(116), amount_msat: Some(Amount { msat: 222231188 }), expiry: Some(851933), payment_hash: Some([251, 162, 173, 3, 4, 70, 47, 41, 66, 211, 192, 116, 89, 241, 51, 47, 224, 60, 227, 198, 199, 102, 123, 180, 240, 178, 210, 205, 159, 187, 201, 213]), local_trimmed: None, status: None, state: Some(SentRemoveRevocation) }, ListpeerchannelsChannelsHtlcs { direction: Some(Out), id: Some(115), amount_msat: Some(Amount { msat: 97768235 }), expiry: Some(851933), payment_hash: Some([251, 162, 173, 3, 4, 70, 47, 41, 66, 211, 192, 116, 89, 241, 51, 47, 224, 60, 227, 198, 199, 102, 123, 180, 240, 178, 210, 205, 159, 187, 201, 213]), local_trimmed: None, status: None, state: Some(SentRemoveRevocation) }, ListpeerchannelsChannelsHtlcs { direction: Some(Out), id: Some(118), amount_msat: Some(Amount { msat: 135644467 }), expiry: Some(851933), payment_hash: Some([251, 162, 173, 3, 4, 70, 47, 41, 66, 211, 192, 116, 89, 241, 51, 47, 224, 60, 227, 198, 199, 102, 123, 180, 240, 178, 210, 205, 159, 187, 201, 213]), local_trimmed: None, status: None, state: Some(SentRemoveRevocation) }], close_to_addr: Some("bc1plfvjvrc5uhhruc3nfkva5h0g2me67u85l540kp7e33y0val0kqeqs0f9nl") }] }

roeierez commented 1 month ago

Here is another case for this issue: https://github.com/breez/breez-sdk-relai/issues/40#issuecomment-2242591325

cdecker commented 1 month ago

As far as I can see we somehow missed the sweep of output 3, which is the second stage HTLC transaction, thus we continued trying to push the second stage out. This is a bug in CLN we are currently hunting down, but we can restart the node with --rescan=-height where height is below the close, and have it trace through the entire close again.

I did that, and the next time the user comes online (with its signer) it'll go through the close. If the user doesn't close the app too soon, we should automatically pick everything up.

roeierez commented 1 month ago

@cdecker see this: https://github.com/breez/breez-sdk-relai/issues/83#issuecomment-2256143016 Are you abel to check if the rescan has finished?