]> git.bitcoin.ninja Git - rust-lightning/commit
Send bogus ChannelReestablish for unknown channels
authorWilmer Paulino <wilmer@wilmerpaulino.com>
Wed, 11 Oct 2023 16:42:05 +0000 (09:42 -0700)
committerWilmer Paulino <wilmer@wilmerpaulino.com>
Wed, 18 Oct 2023 18:25:25 +0000 (11:25 -0700)
commit9f7de472fb5e5371f8d697941b6ab443fadb220f
tree76d2dfbdd6c53c3b6e2c34dfd92fa441c211f333
parent989304ed3623a578dc9ad0d9aac0984da0d43584
Send bogus ChannelReestablish for unknown channels

Unfortunately, lnd doesn't force close on errors
(https://github.com/lightningnetwork/lnd/blob/abb1e3463f3a83bbb843d5c399869dbe930ad94f/htlcswitch/link.go#L2119).
One of the few ways to get an lnd counterparty to force close is by
replicating what they do when restoring static channel backups (SCBs).
They send an invalid `ChannelReestablish` with `0` commitment numbers
and an invalid `your_last_per_commitment_secret`.

Since we received a `ChannelReestablish` for a channel that doesn't
exist, we can assume it's likely the channel closed from our point of
view, but it remains open on the counterparty's side. By sending this
bogus `ChannelReestablish` message now as a response to theirs, we
trigger them to force close broadcasting their latest state. If the
closing transaction from our point of view remains unconfirmed, it'll
enter a race with the counterparty's to-be-broadcast latest commitment
transaction.
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/payment_tests.rs
lightning/src/ln/reload_tests.rs
lightning/src/ln/shutdown_tests.rs