lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.72k stars 2.09k forks source link

Incorrect force close transaction info in listchaintxns #6939

Open jamaljsr opened 2 years ago

jamaljsr commented 2 years ago

Background

When force-closing a channel, the txn gets broadcasted to the chain. After mining a block and seeing the txn is confirmed via bitcoind, the response from lncli listchaintxns still shows "num_confirmations": 0. Even after mining many blocks past the pending channel's maturity_height, the num_confirmations never changes from 0. According to bitcoind, the transaction has 1924 confs.

Also, after restarting the node, the record of the txn in listchaintxns disappears. The closed channel still shows the correct closing_tx_hash and bitcoind still says its confirmed.

Your environment

Steps to reproduce

  1. Force-close a channel
  2. Confirm that the transaction has been broadcast to the bitcoin mempool
  3. Mine some blocks
  4. verify on the bitcoin node that the transaction is confirmed
  5. Run lncli listchaintxns to see the num_confirmations value still set to 0
  6. Restart the node
  7. Run lncli listchaintxns to see that the transaction is no longer listed

Expected behaviour

  1. The num_confirmations value should increment with each block mined after the channel is force-closed.
  2. The transaction should not be removed from lncli listchaintxns after restarting the node

Actual behaviour

  1. The num_confirmations value never changes from 0
  2. The transaction is no longer listed in lncli listchaintxns after a restart
ellemouton commented 2 years ago

nice catch! Have re-created the scenario you described and can confirm the issue. ~Will look into this this week :+1:~ have been informed that someone else is looking into it :)

shocknet-justin commented 2 years ago

I have some force closes stuck pending, but the blocks till maturity is a negative number.

Related?

shocknet-justin commented 2 years ago

I have some force closes stuck pending, but the blocks till maturity is a negative number.

Related?

Had an issue with this node resolved by upgrading btcd to 23.1 but that has not resolved the limbo balances

Nevermind, a sweep transaction did fire.

michaelWuensch commented 1 year ago

I can confirm this issue. It leads to a really confusing user experience.

rox1338 commented 2 weeks ago

I can also confirm this issue.