htlcswitch: extend ChannelLink interface with ShutdownIfChannelClean

This allows a caller to ensure to optimistically shut down the link
if the channel is clean. If the channel is not clean, an error is
returned and the link continues functioning as normal. The caller
should also call RemoveLink to ensure that the link isn't seen as
usable within the switch.
This commit is contained in:
eugene
2021-08-10 16:59:17 -04:00
parent 7621d7f902
commit b2e90480ed
5 changed files with 149 additions and 6 deletions

View File

@@ -88,6 +88,11 @@ type ChannelUpdateHandler interface {
// MayAddOutgoingHtlc returns an error if we may not add an outgoing
// htlc to the channel.
MayAddOutgoingHtlc() error
// ShutdownIfChannelClean shuts the link down if the channel state is
// clean. This can be used with dynamic commitment negotiation or coop
// close negotiation which require a clean channel state.
ShutdownIfChannelClean() error
}
// ChannelLink is an interface which represents the subsystem for managing the