notary: simplify key presence check with slices

Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
Roman Khimov 2024-08-27 12:28:51 +03:00
parent 8925b42250
commit c07604fbf3

View file

@ -1,6 +1,8 @@
package notary
import (
"slices"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
"github.com/nspcc-dev/neo-go/pkg/util"
@ -13,12 +15,8 @@ func (n *Notary) UpdateNotaryNodes(notaryNodes keys.PublicKeys) {
n.accMtx.Lock()
defer n.accMtx.Unlock()
if n.currAccount != nil {
for _, node := range notaryNodes {
if node.Equal(n.currAccount.PublicKey()) {
return
}
}
if n.currAccount != nil && slices.ContainsFunc(notaryNodes, n.currAccount.PublicKey().Equal) {
return
}
var acc *wallet.Account