lnd icon indicating copy to clipboard operation
lnd copied to clipboard

With watchtower: breached channel does not show in list/pending/closedchannels for unconfirmed justice tx

Open C-Otto opened this issue 3 years ago • 11 comments
trafficstars

Background

I had some fun on testnet and breached one of my channels:

  • have channel between nodes A and B
  • enable watchtower server on node C and use it from node A (node A is client, node C is server)
  • have some updates on channel between A and B
  • shutdown node A
  • restart node B with an old state
  • force-close channel from B with old state
  • wait for watchtower to broadcast justice transaction
  • start node A

As far as I can see the watchtower did exactly what it should do. Node A also realized the breach after the restart.

However, the breached channel does not show up in node A's listchannels / pendingchannels / closedchannels. Currently, the justice transaction is still in the mempool. The recovered amount does not show in node A's walletbalance (neither confirmed nor pending).

Your environment

  • version of lnd: 9572b49922d77e2605cda27f3ddcbe9b21567828 (master 21 Apr 2022)
  • which operating system (uname -a on *Nix): Linux home 5.16.2 #1 SMP PREEMPT Thu Jan 20 21:00:54 CET 2022 x86_64 GNU/Linux
  • version of btcd, bitcoind, or other backend: bitcoind v22
  • any other relevant environment details: TESTNET

Expected behaviour

Breached channel shows up in lncli pendingchannels (or listchannels/closedchannels).

Actual behaviour

It does not show.

C-Otto avatar Apr 24 '22 11:04 C-Otto

It shows up as closed once the justice transaction (broadcast by my watchtower) is confirmed.

C-Otto avatar Apr 24 '22 11:04 C-Otto

Was the breach transaction already confirmed at the point where you looked at listchannels/pendingchannels? In general lnd doesn't update channel states until the closing transactions have confirmed. Because with Neutrino you wouldn't be able to watch the mempool in the first place.

guggero avatar Apr 25 '22 07:04 guggero

Yes. Otherwise I think it would still show up in "listchannels".

C-Otto avatar Apr 25 '22 07:04 C-Otto

It shows up as closed once the justice transaction (broadcast by my watchtower) is confirmed.

If I understand the scenario correctly: this is to be expected, we don't watch the mempool for anything other than direct credits to the internal wallet (unconfirmed balanced).

If we wanted to change this, then we'd need to do something like have the tower notify lnd that it did its job. But AFAICT, everything is working as expected: we only act on chain confirmations.

Roasbeef avatar Apr 29 '22 00:04 Roasbeef

However, the breached channel does not show up in node A's listchannels / pendingchannels / closedchannels

So it's that during the external breach handling (by the tower), the channel looks as if it doesn't exist from lnd's PoV until the justice transaction hits the chain?

Roasbeef avatar Apr 29 '22 00:04 Roasbeef

So it's that during the external breach handling (by the tower), the channel looks as if it doesn't exist from lnd's PoV until the justice transaction hits the chain?

Yes, exactly. This happens once lnd learns about the breach transaction, I think, but before the justice transaction is confirmed.

I'm perfectly fine with how everything is shown once the justice transaction is confirmed.

C-Otto avatar Apr 29 '22 06:04 C-Otto

Were you able to reliably produce this result? I have not yet been able to re-produce it

ellemouton avatar Feb 03 '23 15:02 ellemouton

I only tried once, sorry.

C-Otto avatar Feb 03 '23 17:02 C-Otto

Closing this issue due to missing reproduction and no activity

saubyk avatar May 01 '24 03:05 saubyk

Please reeopen. If you want me to reproduce this, just say so. I posted the necessary steps in the issue. @saubyk

C-Otto avatar May 01 '24 07:05 C-Otto

@C-Otto - yeah a reproduction would be useful. I tried to repro this last time I looked at it and was unable to

ellemouton avatar May 08 '24 08:05 ellemouton