Skip to content

Commit b4d99e3

Browse files
authored
eth/ethconfig: improve error message if TTD missing (#30807)
This updates the message you get when trying to initialize Geth with genesis.json that doesn't have `terminalTotalDifficulty`. The previous message was a bit obscure, I had to check the code to find out what the problem was.
1 parent 2380012 commit b4d99e3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

eth/ethconfig/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"github.com/ethereum/go-ethereum/eth/downloader"
3333
"github.com/ethereum/go-ethereum/eth/gasprice"
3434
"github.com/ethereum/go-ethereum/ethdb"
35+
"github.com/ethereum/go-ethereum/log"
3536
"github.com/ethereum/go-ethereum/miner"
3637
"github.com/ethereum/go-ethereum/params"
3738
)
@@ -160,7 +161,8 @@ type Config struct {
160161
// only exist on already merged networks.
161162
func CreateConsensusEngine(config *params.ChainConfig, db ethdb.Database) (consensus.Engine, error) {
162163
if config.TerminalTotalDifficulty == nil {
163-
return nil, fmt.Errorf("only PoS networks are supported, please transition old ones with Geth v1.13.x")
164+
log.Error("Geth only supports PoS networks. Please transition legacy networks using Geth v1.13.x.")
165+
return nil, fmt.Errorf("'terminalTotalDifficulty' is not set in genesis block")
164166
}
165167
// Wrap previously supported consensus engines into their post-merge counterpart
166168
if config.Clique != nil {

0 commit comments

Comments
 (0)