htlcswitch: add new LinkFailureAction enum

In this commit, we add a new LinkFailureAction enum to take over the old
force close bool. Force closing isn't the only thing we might want to do
when we decide to fail the link, so this is a prep refactoring for an
upcoming change.
This commit is contained in:
Olaoluwa Osuntokun committed 2023-05-23 12:24:55 -07:00
1 parent 7dacf5edb9
commit cb5fc71659
4 files changed
+33 -21

No files matched your search

+5 -4
View File
@@ -5457,8 +5457,9 @@ func TestChannelLinkFail(t *testing.T) {
// If we expect the link to force close the channel in this
// case, check that it happens. If not, make sure it does not
// happen.
require.Equal(
t, test.shouldForceClose, linkErr.ForceClose, test.name,
isForceCloseErr := (linkErr.FailureAction == LinkFailureForceClose)
require.True(
t, test.shouldForceClose == isForceCloseErr, test.name,
)
require.Equal(
t, test.permanentFailure, linkErr.PermanentFailure,
@@ -6523,7 +6524,7 @@ func TestPipelineSettle(t *testing.T) {
// ForceClose should be false.
select {
case linkErr := <-linkErrors:
require.False(t, linkErr.ForceClose)
require.False(t, linkErr.FailureAction == LinkFailureForceClose)
case <-forwardChan:
t.Fatal("packet was erroneously forwarded")
}
@@ -6559,7 +6560,7 @@ func TestPipelineSettle(t *testing.T) {
// ForceClose should be false.
select {
case linkErr := <-linkErrors:
require.False(t, linkErr.ForceClose)
require.False(t, linkErr.FailureAction == LinkFailureForceClose)
case <-forwardChan:
t.Fatal("packet was erroneously forwarded")
}