htlcswitch/link: use return instead of break out

There is no clean up logic after the loop, done purely to improve
clarity.
This commit is contained in:
Conner Fromknecht 2020-04-14 10:50:45 -07:00
parent 16ad0274c9
commit 6fca22be2b
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -1010,13 +1010,12 @@ func (l *channelLink) htlcManager() {
go l.fwdPkgGarbager() go l.fwdPkgGarbager()
} }
out:
for { for {
// We must always check if we failed at some point processing // We must always check if we failed at some point processing
// the last update before processing the next. // the last update before processing the next.
if l.failed { if l.failed {
l.log.Errorf("link failed, exiting htlcManager") l.log.Errorf("link failed, exiting htlcManager")
break out return
} }
// If the previous event resulted in a non-empty batch, resume // If the previous event resulted in a non-empty batch, resume
@ -1086,7 +1085,7 @@ out:
l.cfg.Peer.WipeChannel(chanPoint) l.cfg.Peer.WipeChannel(chanPoint)
}() }()
break out return
case <-l.cfg.BatchTicker.Ticks(): case <-l.cfg.BatchTicker.Ticks():
// Attempt to extend the remote commitment chain // Attempt to extend the remote commitment chain
@ -1096,7 +1095,7 @@ out:
if err := l.updateCommitTx(); err != nil { if err := l.updateCommitTx(); err != nil {
l.fail(LinkFailureError{code: ErrInternalError}, l.fail(LinkFailureError{code: ErrInternalError},
"unable to update commitment: %v", err) "unable to update commitment: %v", err)
break out return
} }
// A message from the switch was just received. This indicates // A message from the switch was just received. This indicates
@ -1121,11 +1120,11 @@ out:
fmt.Sprintf("process hodl queue: %v", fmt.Sprintf("process hodl queue: %v",
err.Error()), err.Error()),
) )
break out return
} }
case <-l.quit: case <-l.quit:
break out return
} }
} }
} }