Blockstream / greenlight

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

Weird sweep transaction #447

Closed roeierez closed 1 month ago

roeierez commented 2 months ago

Relai: https://github.com/breez/breez-sdk-relai/issues/52 Outputs are swept to the same addresses resulting in loosing fees:

Channel was closed here: https://blockstream.info/tx/463972904772472b38fa1cc907e5143a5af1a008cb373179c22f4d824d72e11f

Two first outputs are anchors and it seems that the 3rd and the 5th are the user's outputs.

The 302744 sats output was swept here: https://blockstream.info/tx/34f9063fbb2e935dd45225c9b45e68dadcd6857e145911d85e20ccee1bdf6bc0 The 72000 sats seems to be swept here: https://blockstream.info/tx/fe770e36682f73a91ee4fbe535828825f2900067492777510d1fa834f9161f93 But this transaction is really strange since it takes two outputs and send them to the same address so it only looses fees.

JordiZDG commented 1 month ago

Any update?

cdecker commented 1 month ago

Did I not have an extensive timeline prepared for this issue? I seem to remember looking into the 72k output (that's an HTLC second stage TX being materialized and then swept).

As far as I can see all outputs are swept correctly, and can be unilaterally spent. The one missing output was #2, which as mentioned above was first moved forward, via the second stage HTLC transaction (a81993c61a586c4d99e8050d70139e03223dfa7a540140d3f59261842a23a1c6:0), and then finally swept after the timeout expired in 00299a87a7180571762ff322d44817816656c1170a7ff20fce83606c658f11a6:0.

Notice that the second stage HTLC transaction is dropped on-chain before the HTLC timeout expires, and as such it is normal for an HTLC to be laying on-chain for a while before the timeout expires, and it can be swept.