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

Autoclose channels that have not been reestablished for a long time #196

Merged
merged 4 commits into from Dec 12, 2023

Conversation

matheusd
Copy link
Member

This adds automation for closing channels that haven't been reestablished for some time.

We add tracking for how long a peer has been online, while NOT reestablishing a channel through the use of ChannelReestablish P2P messages. Channels with peers that have been online for some time but which have NOT been reestablished though the use of ChannelReestablish messages are good candidates for being force closed, because it is likely the remote peer has lost the ability to use them (for example, due to restoring the node after data loss without the use of an SCB file).

Given that the metric tracks the total time across restarts and only while the remote peer is online, we use a default of 72h for the threshold to auto close the channel. This should be a reasonable compromise between not closing too fast on hubs (that are online 24/7) and ephemeral nodes (that may be online only for an hour or two a day)

A config parameter is added to control the threshold time used for autoclosing and an itest is added that asserts the correct behavior.

This adds tracking for how long a peer has been online, while NOT
reestasblishing a channel through the use of ChannelReestablish P2P
messages.

If a peer has been online for a long time without sending a
ChannelReestablish, this is a hint that perhaps their end of the channel
is borked and cannot be used anymore.  One situation where this occurs
is when the peer restores its node without use of an SCB file, in which
case the ChannelReestablish messages the local peer sends are ignored
and the remote peer does not reply with their own ChannelReestablish.
This exposes the recently introduced per-channel total channel
reestablish wait time through the ListChannels RPC interface.

This is a useful debug feature for users.
This adds automation for closing channels that haven't been
reestablished for some time using the recently introduced metric.

Channels with peers that have been online for some time but which have
NOT been reestablished though the use of ChannelReestablish messages are
good candidates for being force closed, because it is likely the remote
peer has lost the ability to use them.

Given that the metric tracks the total time across restarts and only
while the remote peer is online, we use a default of 72h for the
threshold to auto close the channel.  This should be a reasonable
compromise between not closing too fast on hubs (that are online 24/7)
and ephemeral nodes (that may be online only for an hour or two a day).

A config parameter is added to control the threshold time used for
autoclosing and an itest is added that asserts the correct behavior.
@matheusd matheusd merged commit 2e6ca2c into decred:master Dec 12, 2023
9 checks passed
@matheusd matheusd deleted the chan-reestablish-tracking branch December 12, 2023 09:52
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