mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 03:41:45 +00:00
*: do not get private key from Account to check if it CanSign()
We have this API now to performs checks.
This commit is contained in:
parent
8d33206bb8
commit
fd8da6fdb9
4 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue