Skip to content

Commit 92a5d35

Browse files
authored
Merge pull request #9911 from ziggie1984/exit-early-for-fwd-adds
htlcswitch: exit early if no adds are in the fwd pkg
2 parents 32592db + 6feed32 commit 92a5d35

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

htlcswitch/link.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3624,6 +3624,9 @@ func (l *channelLink) updateChannelFee(ctx context.Context,
36243624
// the switch.
36253625
func (l *channelLink) processRemoteSettleFails(fwdPkg *channeldb.FwdPkg) {
36263626
if len(fwdPkg.SettleFails) == 0 {
3627+
l.log.Trace("fwd package has no settle/fails to process " +
3628+
"exiting early")
3629+
36273630
return
36283631
}
36293632

@@ -3728,6 +3731,13 @@ func (l *channelLink) processRemoteSettleFails(fwdPkg *channeldb.FwdPkg) {
37283731
//
37293732
//nolint:funlen
37303733
func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg) {
3734+
// Exit early if there are no adds to process.
3735+
if len(fwdPkg.Adds) == 0 {
3736+
l.log.Trace("fwd package has no adds to process exiting early")
3737+
3738+
return
3739+
}
3740+
37313741
l.log.Tracef("processing %d remote adds for height %d",
37323742
len(fwdPkg.Adds), fwdPkg.Height)
37333743

0 commit comments

Comments
 (0)