mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-11-23 22:15:54 +00:00
refactor: use slices.Contains to simplify code
Signed-off-by: one230six <723682061@qq.com>
This commit is contained in:
parent
4bb5bf25d3
commit
63280ed437
@ -1,5 +1,7 @@
|
||||
package externalapi
|
||||
|
||||
import "slices"
|
||||
|
||||
// BlockLevelParents represent the parents within a single super-block level
|
||||
// See https://github.com/kaspanet/research/issues/3 for further details
|
||||
type BlockLevelParents []*DomainHash
|
||||
@ -10,13 +12,7 @@ func (sl BlockLevelParents) Equal(other BlockLevelParents) bool {
|
||||
return false
|
||||
}
|
||||
for _, thisHash := range sl {
|
||||
found := false
|
||||
for _, otherHash := range other {
|
||||
if thisHash.Equal(otherHash) {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
found := slices.ContainsFunc(other, thisHash.Equal)
|
||||
if !found {
|
||||
return false
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user