Skip to content

Commit

Permalink
Set FullHeaderChainAvailable according to sync mode (#931)
Browse files Browse the repository at this point in the history
* looks like this was always false

* Update cmd/utils/flags.go

Co-Authored-By: Victor "Nate" Graf <victor@celo.org>

Co-authored-by: Victor "Nate" Graf <victor@celo.org>
  • Loading branch information
mrsmkl and Victor "Nate" Graf authored Mar 20, 2020
1 parent dd8c600 commit 711f0a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1861,12 +1861,10 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
var err error
chainDb = MakeChainDatabase(ctx, stack)
config, _, err := core.SetupGenesisBlock(chainDb, MakeGenesis(ctx))
if ctx.GlobalString(SyncModeFlag.Name) == "lightest" {
config.FullHeaderChainAvailable = false
}
if err != nil {
Fatalf("%v", err)
}
config.FullHeaderChainAvailable = ctx.GlobalString(SyncModeFlag.Name) != "lightest"
var engine consensus.Engine
if config.Clique != nil {
engine = clique.New(config.Clique, chainDb)
Expand Down
4 changes: 2 additions & 2 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
return nil, genesisErr
}
log.Info("Initialised chain configuration", "config", chainConfig)
fullHeaderChainAvailable := config.SyncMode.SyncFullHeaderChain()
chainConfig.FullHeaderChainAvailable = config.SyncMode.SyncFullHeaderChain()

eth := &Ethereum{
config: config,
Expand All @@ -164,7 +164,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
gatewayFee: config.GatewayFee,
blsbase: config.BLSbase,
bloomRequests: make(chan chan *bloombits.Retrieval),
bloomIndexer: NewBloomIndexer(chainDb, params.BloomBitsBlocks, params.BloomConfirms, fullHeaderChainAvailable),
bloomIndexer: NewBloomIndexer(chainDb, params.BloomBitsBlocks, params.BloomConfirms, chainConfig.FullHeaderChainAvailable),
}

bcVersion := rawdb.ReadDatabaseVersion(chainDb)
Expand Down

0 comments on commit 711f0a6

Please sign in to comment.