Delay considering a channel closed when seeing an on-chain spend #2936
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See issue #2437
When an external channel is spent, the router will add it to a new
spentChannels
map instead of immediately removing it from the graph.If after 12 blocks an entry in the
spentChannels
map is not part of a splice, it will be removed as before.When a newly added channel is validated, if it spends the shared output of a recently spent channel then it is a splice.
A splice will update the
shortChannelId
andcapacity
of graph edges of the parent channel instead of removing the parent's edges and adding edges for a new channel. A splice will also reuse and adjust the parent edge's low/high balance bounds information based on the splice.Because a spent channel could be re-added to the graph if our node is restarted before the 12-block delay, spent channels will be removed from the network db at the time they are spent. Nodes that are isolated when their last channel is spent will not be removed from the db until after the 12-block delay. Isolated nodes will also be removed from the network database when our node is restarted.