mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-03-08 23:34:28 +00:00
notary: simplify key presence check with slices
Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
8925b42250
commit
c07604fbf3
1 changed files with 4 additions and 6 deletions
|
@ -1,6 +1,8 @@
|
||||||
package notary
|
package notary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"slices"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"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/encoding/address"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||||
|
@ -13,12 +15,8 @@ func (n *Notary) UpdateNotaryNodes(notaryNodes keys.PublicKeys) {
|
||||||
n.accMtx.Lock()
|
n.accMtx.Lock()
|
||||||
defer n.accMtx.Unlock()
|
defer n.accMtx.Unlock()
|
||||||
|
|
||||||
if n.currAccount != nil {
|
if n.currAccount != nil && slices.ContainsFunc(notaryNodes, n.currAccount.PublicKey().Equal) {
|
||||||
for _, node := range notaryNodes {
|
return
|
||||||
if node.Equal(n.currAccount.PublicKey()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var acc *wallet.Account
|
var acc *wallet.Account
|
||||||
|
|
Loading…
Add table
Reference in a new issue