diff --git a/cli/smartcontract/smart_contract.go b/cli/smartcontract/smart_contract.go index f96935d10..fd39fba8f 100644 --- a/cli/smartcontract/smart_contract.go +++ b/cli/smartcontract/smart_contract.go @@ -892,7 +892,7 @@ func getUnlockedAccount(wall *wallet.Wallet, addr util.Uint160, pass *string) (* return nil, fmt.Errorf("wallet contains no account for '%s'", address.Uint160ToString(addr)) } - if acc.PrivateKey() != nil { + if acc.CanSign() { return acc, nil } diff --git a/pkg/consensus/consensus.go b/pkg/consensus/consensus.go index 38326225a..7e8523ebd 100644 --- a/pkg/consensus/consensus.go +++ b/pkg/consensus/consensus.go @@ -377,7 +377,7 @@ func (s *service) getKeyPair(pubs []crypto.PublicKey) (int, crypto.PrivateKey, c continue } - if acc.PrivateKey() == nil { + if !acc.CanSign() { err := acc.Decrypt(s.Config.Wallet.Password, s.wallet.Scrypt) if err != nil { s.log.Fatal("can't unlock account", zap.String("address", address.Uint160ToString(sh))) diff --git a/pkg/services/notary/node.go b/pkg/services/notary/node.go index 9a7486c56..341131006 100644 --- a/pkg/services/notary/node.go +++ b/pkg/services/notary/node.go @@ -25,7 +25,7 @@ func (n *Notary) UpdateNotaryNodes(notaryNodes keys.PublicKeys) { for _, node := range notaryNodes { acc = n.wallet.GetAccount(node.GetScriptHash()) if acc != nil { - if acc.PrivateKey() != nil { + if acc.CanSign() { break } err := acc.Decrypt(n.Config.MainCfg.UnlockWallet.Password, n.wallet.Scrypt) diff --git a/pkg/services/oracle/nodes.go b/pkg/services/oracle/nodes.go index b20b806c0..0331de62d 100644 --- a/pkg/services/oracle/nodes.go +++ b/pkg/services/oracle/nodes.go @@ -30,7 +30,7 @@ func (o *Oracle) UpdateOracleNodes(oracleNodes keys.PublicKeys) { for i := range oracleNodes { acc = o.wallet.GetAccount(oracleNodes[i].GetScriptHash()) if acc != nil { - if acc.PrivateKey() != nil { + if acc.CanSign() { break } err := acc.Decrypt(o.MainCfg.UnlockWallet.Password, o.wallet.Scrypt)