mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
add check in CreateConensusEngine that TerminalTotalDifficulty is specified. Remove unused parts from HF description generation
This commit is contained in:
parent
1fbde1abaf
commit
739baec2f8
2 changed files with 12 additions and 21 deletions
|
|
@ -18,6 +18,7 @@
|
|||
package ethconfig
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
@ -161,6 +162,9 @@ type Config struct {
|
|||
// Clique is allowed for now to live standalone, but ethash is forbidden and can
|
||||
// only exist on already merged networks.
|
||||
func CreateConsensusEngine(config *params.ChainConfig, db ethdb.Database) (consensus.Engine, error) {
|
||||
if config.TerminalTotalDifficulty == nil {
|
||||
return nil, fmt.Errorf("only PoS networks are supported, please transition old ones with Geth v1.13.x")
|
||||
}
|
||||
// Wrap previously supported consensus engines into their post-merge counterpart
|
||||
if config.Clique != nil {
|
||||
return beacon.New(clique.New(config.Clique, db)), nil
|
||||
|
|
|
|||
|
|
@ -360,17 +360,9 @@ func (c *ChainConfig) Description() string {
|
|||
banner += fmt.Sprintf("Chain ID: %v (%s)\n", c.ChainID, network)
|
||||
switch {
|
||||
case c.Ethash != nil:
|
||||
if c.TerminalTotalDifficulty == nil {
|
||||
banner += "Consensus: Ethash (proof-of-work)\n"
|
||||
} else {
|
||||
banner += "Consensus: Beacon (proof-of-stake), merged from Ethash (proof-of-work)\n"
|
||||
}
|
||||
banner += "Consensus: Beacon (proof-of-stake), merged from Ethash (proof-of-work)\n"
|
||||
case c.Clique != nil:
|
||||
if c.TerminalTotalDifficulty == nil {
|
||||
banner += "Consensus: Clique (proof-of-authority)\n"
|
||||
} else {
|
||||
banner += "Consensus: Beacon (proof-of-stake), merged from Clique (proof-of-authority)\n"
|
||||
}
|
||||
banner += "Consensus: Beacon (proof-of-stake), merged from Clique (proof-of-authority)\n"
|
||||
default:
|
||||
banner += "Consensus: unknown\n"
|
||||
}
|
||||
|
|
@ -405,17 +397,12 @@ func (c *ChainConfig) Description() string {
|
|||
banner += "\n"
|
||||
|
||||
// Add a special section for the merge as it's non-obvious
|
||||
if c.TerminalTotalDifficulty == nil {
|
||||
banner += "The Merge is not yet available for this network!\n"
|
||||
banner += " - Hard-fork specification: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md\n"
|
||||
} else {
|
||||
banner += "Merge configured:\n"
|
||||
banner += " - Hard-fork specification: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md\n"
|
||||
banner += " - Network known to be merged\n"
|
||||
banner += fmt.Sprintf(" - Total terminal difficulty: %v\n", c.TerminalTotalDifficulty)
|
||||
if c.MergeNetsplitBlock != nil {
|
||||
banner += fmt.Sprintf(" - Merge netsplit block: #%-8v\n", c.MergeNetsplitBlock)
|
||||
}
|
||||
banner += "Merge configured:\n"
|
||||
banner += " - Hard-fork specification: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md\n"
|
||||
banner += " - Network known to be merged\n"
|
||||
banner += fmt.Sprintf(" - Total terminal difficulty: %v\n", c.TerminalTotalDifficulty)
|
||||
if c.MergeNetsplitBlock != nil {
|
||||
banner += fmt.Sprintf(" - Merge netsplit block: #%-8v\n", c.MergeNetsplitBlock)
|
||||
}
|
||||
banner += "\n"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue