mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-11-24 06:25:55 +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
|
package externalapi
|
||||||
|
|
||||||
|
import "slices"
|
||||||
|
|
||||||
// BlockLevelParents represent the parents within a single super-block level
|
// BlockLevelParents represent the parents within a single super-block level
|
||||||
// See https://github.com/kaspanet/research/issues/3 for further details
|
// See https://github.com/kaspanet/research/issues/3 for further details
|
||||||
type BlockLevelParents []*DomainHash
|
type BlockLevelParents []*DomainHash
|
||||||
@ -10,13 +12,7 @@ func (sl BlockLevelParents) Equal(other BlockLevelParents) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
for _, thisHash := range sl {
|
for _, thisHash := range sl {
|
||||||
found := false
|
found := slices.ContainsFunc(other, thisHash.Equal)
|
||||||
for _, otherHash := range other {
|
|
||||||
if thisHash.Equal(otherHash) {
|
|
||||||
found = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !found {
|
if !found {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user