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

+4 -5
View File
@@ -3094,11 +3094,10 @@ func (p *Brontide) handleLinkFailure(failure linkFailureReport) {
// being applied.
p.WipeChannel(&failure.chanPoint)
// If the error encountered was severe enough, we'll now force close the
// channel to prevent reading it to the switch in the future.
if failure.linkErr.ForceClose {
p.log.Warnf("Force closing link(%v)",
failure.shortChanID)
// If the error encountered was severe enough, we'll now force close
// the channel to prevent reading it to the switch in the future.
if failure.linkErr.FailureAction == htlcswitch.LinkFailureForceClose {
p.log.Warnf("Force closing link(%v)", failure.shortChanID)
closeTx, err := p.cfg.ChainArb.ForceCloseContract(
failure.chanPoint,