Check the PK of the source of an error before closing chans from it
authorMatt Corallo <git@bluematt.me>
Sat, 16 Jan 2021 02:34:17 +0000 (21:34 -0500)
committerMatt Corallo <git@bluematt.me>
Wed, 10 Feb 2021 00:04:54 +0000 (19:04 -0500)
commit61164afb2bdd19e487ca3ec1c6435baf65e0c3af
tree88fa85b19d9cbcad703f5d2ce6dcf0649183afa3
parentc7ddcd3867757c74d8a3a2997604edf52aa0a536
Check the PK of the source of an error before closing chans from it

When we receive an error message from a peer, it can indicate a
channel which we should close. However, we previously did not
check that the counterparty who sends us such a message is the
counterparty with whom we have the channel, allowing any
connected peer to make us force-close any channel we have as long
as they know the channel id.

This commit simply changes the force-close logic to check that the
sender matches the channel's counterparty node_id, though as noted
in #105, we eventually need to change the indexing anyway to allow
absurdly terrible peers to open channels with us.

Found during review of #777.
lightning/src/ln/channelmanager.rs