decred / dcrlnd

Decred Lightning Network Daemon ⚡️
MIT License
36 stars 24 forks source link

multi: Improve handling of announcements of closed channels #187

Closed matheusd closed 1 year ago

matheusd commented 1 year ago

This improves handling of channel announcements and updates for channels that have been closed.

It's been observed on mainnet that some channels that have been closed on-chain are still being announced on the network. This is being caused by the previous channel owners having an entry of the channel in their graph database. While the root cause of this hasn't been determined, this PR attempts to improve things on both source and remote nodes, specially for nodes running in SPV mode.

This PR introduces a new index to track channels that are determined to be closed by GetUtxo calls, and makes use of this index to reduce the need to keep validating channel annoucements. This is also used for channel updates.

An additional check is added to the recurring channel annoucement retransmission, to verify that the channels are indeed open before signing fresh updates, in order to reduce the likelihood of sending spurious updates.