Skip to content

Commit 6134010

Browse files
authored
refactor: use the built-in max/min to simplify the code (#617)
Signed-off-by: pkucode <[email protected]>
1 parent 1728831 commit 6134010

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

internal/bft/requestpool.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ func (rp *Pool) NextRequests(maxCount int, maxSizeBytes uint64, check bool) (bat
304304
}
305305
}
306306

307-
count := minInt(rp.fifo.Len(), maxCount)
307+
count := min(rp.fifo.Len(), maxCount)
308308
var totalSize uint64
309309
batch = make([][]byte, 0, count)
310310
element := rp.fifo.Front()

internal/bft/util.go

-7
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,6 @@ func proposalSequence(m *protos.Message) uint64 {
6060
return math.MaxUint64
6161
}
6262

63-
func minInt(a, b int) int {
64-
if a < b {
65-
return a
66-
}
67-
return b
68-
}
69-
7063
// MarshalOrPanic marshals or panics when an error occurs
7164
func MarshalOrPanic(msg proto.Message) []byte {
7265
b, err := proto.Marshal(msg)

0 commit comments

Comments
 (0)