Skip to content

Commit e877782

Browse files
authored
refactor: use the built-in max/min to simplify the code (#3121)
Signed-off-by: eroderust <eroderust@outlook.com>
1 parent a02e90b commit e877782

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

block/internal/syncing/syncer.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -893,11 +893,7 @@ func (s *Syncer) gracePeriodForEpoch(epochStart, epochEnd uint64) uint64 {
893893
extra = (avgBytes - threshold) / threshold
894894
}
895895

896-
grace := baseGracePeriodEpochs + extra
897-
if grace > maxGracePeriodEpochs {
898-
grace = maxGracePeriodEpochs
899-
}
900-
return grace
896+
return min(baseGracePeriodEpochs+extra, maxGracePeriodEpochs)
901897
}
902898

903899
// VerifyForcedInclusionTxs checks that every forced-inclusion tx submitted

0 commit comments

Comments
 (0)