Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit 3815939

Browse files
committed
consortium: remove unused genesis in consensus engine
1 parent 9e55df7 commit 3815939

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

consensus/consortium/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ type Consortium struct {
2727
}
2828

2929
// New creates a Consortium proxy that decides what Consortium version will be called
30-
func New(chainConfig *params.ChainConfig, db ethdb.Database, ee *ethapi.PublicBlockChainAPI, genesisHash common.Hash) *Consortium {
30+
func New(chainConfig *params.ChainConfig, db ethdb.Database, ee *ethapi.PublicBlockChainAPI) *Consortium {
3131
// Set any missing consensus parameters to their defaults
3232
consortiumV1 := v1.New(chainConfig, db, ee)
33-
consortiumV2 := v2.New(chainConfig, db, ee, genesisHash, consortiumV1)
33+
consortiumV2 := v2.New(chainConfig, db, ee, consortiumV1)
3434

3535
return &Consortium{
3636
chainConfig: chainConfig,

consensus/consortium/v2/consortium.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ type Consortium struct {
9494
chainConfig *params.ChainConfig
9595
config *params.ConsortiumConfig // Consensus engine configuration parameters
9696
forkedBlock uint64
97-
genesisHash common.Hash
9897
db ethdb.Database // Database to store and retrieve snapshot checkpoints
9998

10099
recents *lru.ARCCache // Snapshots for recent block to speed up reorgs
@@ -120,7 +119,6 @@ func New(
120119
chainConfig *params.ChainConfig,
121120
db ethdb.Database,
122121
ethAPI *ethapi.PublicBlockChainAPI,
123-
genesisHash common.Hash,
124122
v1 consortiumCommon.ConsortiumAdapter,
125123
) *Consortium {
126124
consortiumConfig := chainConfig.Consortium
@@ -136,7 +134,6 @@ func New(
136134
consortium := Consortium{
137135
chainConfig: chainConfig,
138136
config: consortiumConfig,
139-
genesisHash: genesisHash,
140137
db: db,
141138
ethAPI: ethAPI,
142139
recents: recents,

eth/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
163163
log.Info("Unprotected transactions allowed")
164164
}
165165
ethAPI := ethapi.NewPublicBlockChainAPI(eth.APIBackend)
166-
eth.engine = ethconfig.CreateConsensusEngine(stack, chainConfig, &ethashConfig, config.Miner.Notify, config.Miner.Noverify, chainDb, ethAPI, genesisHash)
166+
eth.engine = ethconfig.CreateConsensusEngine(stack, chainConfig, &ethashConfig, config.Miner.Notify, config.Miner.Noverify, chainDb, ethAPI)
167167

168168
bcVersion := rawdb.ReadDatabaseVersion(chainDb)
169169
var dbVer = "<nil>"

eth/ethconfig/config.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,21 @@ type Config struct {
225225
}
226226

227227
// CreateConsensusEngine creates a consensus engine for the given chain configuration.
228-
func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, config *ethash.Config, notify []string, noverify bool, db ethdb.Database, ee *ethapi.PublicBlockChainAPI, genesisHash common.Hash) consensus.Engine {
228+
func CreateConsensusEngine(
229+
stack *node.Node,
230+
chainConfig *params.ChainConfig,
231+
config *ethash.Config,
232+
notify []string,
233+
noverify bool,
234+
db ethdb.Database,
235+
ee *ethapi.PublicBlockChainAPI,
236+
) consensus.Engine {
229237
// If proof-of-authority is requested, set it up
230238
if chainConfig.Clique != nil {
231239
return clique.New(chainConfig.Clique, db)
232240
}
233241
if chainConfig.Consortium != nil {
234-
return consortium.New(chainConfig, db, ee, genesisHash)
242+
return consortium.New(chainConfig, db, ee)
235243
}
236244
// Otherwise assume proof-of-work
237245
switch config.PowMode {

les/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) {
109109
eventMux: stack.EventMux(),
110110
reqDist: newRequestDistributor(peers, &mclock.System{}),
111111
accountManager: stack.AccountManager(),
112-
engine: ethconfig.CreateConsensusEngine(stack, chainConfig, &config.Ethash, nil, false, chainDb, nil, genesisHash),
112+
engine: ethconfig.CreateConsensusEngine(stack, chainConfig, &config.Ethash, nil, false, chainDb, nil),
113113
bloomRequests: make(chan chan *bloombits.Retrieval),
114114
bloomIndexer: core.NewBloomIndexer(chainDb, params.BloomBitsBlocksClient, params.HelperTrieConfirmations),
115115
p2pServer: stack.Server(),

0 commit comments

Comments
 (0)