forked from TrueCloudLab/neoneo-go
*: 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))
|
return nil, fmt.Errorf("wallet contains no account for '%s'", address.Uint160ToString(addr))
|
||||||
}
|
}
|
||||||
|
|
||||||
if acc.PrivateKey() != nil {
|
if acc.CanSign() {
|
||||||
return acc, nil
|
return acc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -377,7 +377,7 @@ func (s *service) getKeyPair(pubs []crypto.PublicKey) (int, crypto.PrivateKey, c
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if acc.PrivateKey() == nil {
|
if !acc.CanSign() {
|
||||||
err := acc.Decrypt(s.Config.Wallet.Password, s.wallet.Scrypt)
|
err := acc.Decrypt(s.Config.Wallet.Password, s.wallet.Scrypt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log.Fatal("can't unlock account", zap.String("address", address.Uint160ToString(sh)))
|
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 {
|
for _, node := range notaryNodes {
|
||||||
acc = n.wallet.GetAccount(node.GetScriptHash())
|
acc = n.wallet.GetAccount(node.GetScriptHash())
|
||||||
if acc != nil {
|
if acc != nil {
|
||||||
if acc.PrivateKey() != nil {
|
if acc.CanSign() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
err := acc.Decrypt(n.Config.MainCfg.UnlockWallet.Password, n.wallet.Scrypt)
|
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 {
|
for i := range oracleNodes {
|
||||||
acc = o.wallet.GetAccount(oracleNodes[i].GetScriptHash())
|
acc = o.wallet.GetAccount(oracleNodes[i].GetScriptHash())
|
||||||
if acc != nil {
|
if acc != nil {
|
||||||
if acc.PrivateKey() != nil {
|
if acc.CanSign() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
err := acc.Decrypt(o.MainCfg.UnlockWallet.Password, o.wallet.Scrypt)
|
err := acc.Decrypt(o.MainCfg.UnlockWallet.Password, o.wallet.Scrypt)
|
||||||
|
|
Loading…
Reference in a new issue