Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay considering a channel closed when seeing an on-chain spend #2936

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

remyers
Copy link
Contributor

@remyers remyers commented Nov 4, 2024

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 and capacity 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.

@remyers
Copy link
Contributor Author

remyers commented Nov 4, 2024

@thomash-acinq how do you think a splice should change the low/high bounds estimate for a graph edge? This PR currenty increases the 'high' for the edge by the amount a spliced channel's capacity increases and decrease the 'low' for the edge by the amount it's capacity decreases. Is that correct? I tried to copy the logic used currently when an channel is added or removed, but only for the change in capacity instead of the entire channel's capacity.

@thomash-acinq
Copy link
Member

@thomash-acinq how do you think a splice should change the low/high bounds estimate for a graph edge? This PR currenty increases the 'high' for the edge by the amount a spliced channel's capacity increases and decrease the 'low' for the edge by the amount it's capacity decreases. Is that correct? I tried to copy the logic used currently when an channel is added or removed, but only for the change in capacity instead of the entire channel's capacity.

That looks good.

Issue ACINQ#2437

When external channel is spent, add it to the spentChannels list instead of immediately removing it from the graph.

Remove spent channels after 12 blocks. 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 updates the graph edges to preserve balance estimate information in the graph.

Channels are immediately removed from the db so they will not added to the graph if a restart occurs before 12-blocks elapse.
@remyers remyers marked this pull request as ready for review November 6, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants