Skip to content

Commit

Permalink
Added missing error handling on firehose.Init call
Browse files Browse the repository at this point in the history
  • Loading branch information
maoueh committed Sep 14, 2023
1 parent 56a453e commit e87d57c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions firehose/globals.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func Init(
// We must check for both `nil` and `(*core.Genesis)(nil)`, latter case that is not catch by using `genesis == nil` directly
if !isNilInterfaceOrNilValue(genesis) {
GenesisConfig = genesis
genesisProvenance = "Geth Specific Flag"
genesisProvenance = "Geth Specific Flag (--<chain>)"
} else {
if genesisFilePath := genesisFile; genesisFilePath != "" {
file, err := os.Open(genesisFilePath)
Expand All @@ -98,7 +98,7 @@ func Init(
}

GenesisConfig = genesis
genesisProvenance = "User provider"
genesisProvenance = "Firehose Specific Flag (--firehose-genesis <file>)"
}
}

Expand Down
6 changes: 4 additions & 2 deletions internal/debug/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,17 @@ func Setup(ctx *cli.Context, firehoseGenesis *core.Genesis, firehoseGethVersion
StartPProf(address, !ctx.GlobalIsSet("metrics.addr"))
}

firehose.Init(ctx.GlobalBool(firehoseEnabledFlag.Name),
if err := firehose.Init(ctx.GlobalBool(firehoseEnabledFlag.Name),
ctx.GlobalBoolT(firehoseSyncInstrumentationFlag.Name),
ctx.GlobalBool(firehoseMiningEnabledFlag.Name),
ctx.GlobalBool(firehoseBlockProgressFlag.Name),
firehoseGenesis,
ctx.GlobalString(firehoseGenesisFileFlag.Name),
func() interface{} { return new(core.Genesis) },
firehoseGethVersion,
)
); err != nil {
return fmt.Errorf("initializing firehose: %w", err)
}

return nil
}
Expand Down

0 comments on commit e87d57c

Please sign in to comment.