lightninglabs / chantools

A loose collection of tools all somehow related to lnd and Lightning Network channels.
MIT License
222 stars 32 forks source link

api: check for an output to be unspent. #156

Closed ziggie1984 closed 2 months ago

ziggie1984 commented 2 months ago

Fixes a bug where we would assume outputs are unspent although they were not.

Example:

while sweeping the remote close of this channel:

https://mempool.space/address/bc1q96vq7jhl552ucgy79q7zqny27jmlgq6nmspmcvuw97dgsdedlpusnxamhj

the to_remote addr has unfortunately two outputs of two different channel closures (prob. some kind of LND bug), so when querying for the unspent addr utxos, we need to make sure before including the utxo we query the mempool for the spendness of this UTXO.

to_remote addr has two channel closures associated with it:

https://mempool.space/address/bc1qkvtux0hk28qtn7njdjlym2pmhtq799r36yt8a4cuqs0ejm6z520sz4xkqe

ziggie1984 commented 2 months ago

PR was tested by the person who run into this problem, and it worked for him.

guggero commented 2 months ago

Hey Ziggie. Thanks for the fix. But is it possible you're using an old base? I fixed this in 83aa752d, which just hasn't been in a release yet. Can create a release if that helps.

ziggie1984 commented 2 months ago

True, always a step ahead :).

I think it makes sense to release a new version with this bugfix.

guggero commented 2 months ago

https://github.com/lightninglabs/chantools/releases/tag/v0.13.2