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

Remember pruned channels #706

Merged
merged 7 commits into from Sep 17, 2018
Merged

Remember pruned channels #706

merged 7 commits into from Sep 17, 2018

Conversation

pm47
Copy link
Member

@pm47 pm47 commented Sep 17, 2018

Currently we don't remember channels that we have pruned, so we will happily revalidate the same channels again if a node re-sends them to us, and prune them again, a.k.a. the "zombie churn".

Before channel queries, rejecting a stale channel without validating it wasn't trivial, because nodes sent us the channel_announcement before channel_updates, and only after receiving the channel_update could we know if the channel was still stale. Since we had no way of requesting the channel_announcement for one particular channel, we would have to buffer it, which would lead to potential DOS issues.

But now that we have channel queries, we can now be much more efficient. Process goes like this:
(1) channel x is detected as stale gets pruned, and its id is added to the pruned db
(2) later on we receive a channel_announcement from Eve, we ignore it because the channel is in the pruned db
(3) we also receive old channel_updates from Eve nodes, just ignore them because we don't know the channel
(4) then one day some other node George sends us the channel_announcement, we still ignore it because the channel is still in the pruned db
(5) but then George sends us recent channel_updates, and we know that the channel is back from the dead. We ignore those channel_updates, but we aldo remove the channel id from the pruned db, and we request announcements for that node from George
(6) George sends us the channel_announcement again, we validate it
(7) George then sends us the channel_updates again, we process them
(8) done!

Needless to say that this leads to a huge reduction in CPU/bandwidth usage on well-connected nodes.

Fixes #624.

We won't revalidate them if we don't have a good reason to, that is
until we receive a recent `channel_update` again.

Fixes #624.
@pm47 pm47 requested a review from sstone September 17, 2018 12:01
This was needed when we didn't remember pruned channels. But now we
never have pruned channels in memory, they are cleaned up on
`TickPruneStaleChannels` and never re-added unless they have a recent
`channel_update`.
sstone
sstone previously approved these changes Sep 17, 2018
@pm47 pm47 merged commit 2c1811d into master Sep 17, 2018
@pm47 pm47 deleted the remember-pruned branch September 17, 2018 16:30
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.

None yet

2 participants