Skip to content

Commit 55f41d1

Browse files
authored
cmd/utils: fix error at geth startup in --dev mode (ethereum#26550)
This fixes a regression in ethereum#26541 where we turned the miner address being missing into a startup error. The address was not configured in --dev mode.
1 parent 2a2b041 commit 55f41d1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmd/utils/flags.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
19121912
// when we're definitely concerned with only one account.
19131913
passphrase = list[0]
19141914
}
1915+
19151916
// Unlock the developer account by local keystore.
19161917
var ks *keystore.KeyStore
19171918
if keystores := stack.AccountManager().Backends(keystore.KeyStoreType); len(keystores) > 0 {
@@ -1920,6 +1921,8 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
19201921
if ks == nil {
19211922
Fatalf("Keystore is not available")
19221923
}
1924+
1925+
// Figure out the dev account address.
19231926
// setEtherbase has been called above, configuring the miner address from command line flags.
19241927
if cfg.Miner.Etherbase != (common.Address{}) {
19251928
developer = accounts.Account{Address: cfg.Miner.Etherbase}
@@ -1931,6 +1934,10 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
19311934
Fatalf("Failed to create developer account: %v", err)
19321935
}
19331936
}
1937+
// Make sure the address is configured as fee recipient, otherwise
1938+
// the miner will fail to start.
1939+
cfg.Miner.Etherbase = developer.Address
1940+
19341941
if err := ks.Unlock(developer, passphrase); err != nil {
19351942
Fatalf("Failed to unlock developer account: %v", err)
19361943
}

0 commit comments

Comments
 (0)