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
@@ -127,7 +127,11 @@ func newNode(typ nodetype, genesis *core.Genesis, enodes []*enode.Node) *ethNode
// Inject the signer key and start sealing with it
stack.AccountManager().AddBackend(keystore.NewPlaintextKeyStore("beacon-stress"))
store := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
ks := stack.AccountManager().Backends(keystore.KeyStoreType)
if len(ks) == 0 {
panic("Keystore is not available")
}
store := ks[0].(*keystore.KeyStore)
if _, err := store.NewAccount(""); err != nil {
panic(err)
}