cmd, miner, signer: avoid panic if keystore is not available (#27039)

* cmd, miner, singer: avoid panic if keystore is not available

* cmd/geth: print warning instead of panic
This commit is contained in:
rjl493456442
2023-04-03 05:08:06 -04:00
committed by GitHub
parent 7076ae00aa
commit 94457cce07
4 changed files with 31 additions and 6 deletions
+5 -1
View File
@@ -111,7 +111,11 @@ func (s *UIServerAPI) DeriveAccount(url string, path string, pin *bool) (account
// fetchKeystore retrieves the encrypted keystore from the account manager.
func fetchKeystore(am *accounts.Manager) *keystore.KeyStore {
return am.Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
ks := am.Backends(keystore.KeyStoreType)
if len(ks) == 0 {
return nil
}
return ks[0].(*keystore.KeyStore)
}
// ImportRawKey stores the given hex encoded ECDSA key into the key directory,