Skip to content

Commit 592cf45

Browse files
authored
chore: use slices.Equal to simplify code (#13002)
Signed-off-by: xixishidibei <xixishidibei@outlook.com>
1 parent 062ce4d commit 592cf45

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

chain/types/tipset.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"fmt"
77
"io"
8+
"slices"
89
"sort"
910

1011
"github.com/ipfs/go-cid"
@@ -172,17 +173,7 @@ func (ts *TipSet) Equals(ots *TipSet) bool {
172173
return false
173174
}
174175

175-
if len(ts.cids) != len(ots.cids) {
176-
return false
177-
}
178-
179-
for i, cid := range ts.cids {
180-
if cid != ots.cids[i] {
181-
return false
182-
}
183-
}
184-
185-
return true
176+
return slices.Equal(ts.cids, ots.cids)
186177
}
187178

188179
func (t *Ticket) Less(o *Ticket) bool {

0 commit comments

Comments
 (0)