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.
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
beforechannel_update
s, and only after receiving thechannel_update
could we know if the channel was still stale. Since we had no way of requesting thechannel_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_update
s 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_update
s, and we know that the channel is back from the dead. We ignore thosechannel_update
s, 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_update
s 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.