Skip to content

Commit

Permalink
main: fix eth backend API initialization (ethereum#278)
Browse files Browse the repository at this point in the history
Date: 2021-01-08 07:16:52-06:00
Signed-off-by: meows <b5c6@protonmail.com>
  • Loading branch information
meowsbits authored Jan 8, 2021
1 parent 31013d1 commit e90b9a1
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions cmd/faucet/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,27 +545,29 @@ func (f *faucet) startStack(genesis *genesisT.Genesis, port int, enodes []*discv
log.Info("Config discovery", "urls", cfg.DiscoveryURLs)

// Establish the backend and enable stats reporting if configured to do so.
if *statsFlag != "" {
switch *syncmodeFlag {
case "light":
lesBackend, err := les.New(stack, &cfg)
if err != nil {
return fmt.Errorf("Failed to register the Ethereum service: %w", err)
}
switch *syncmodeFlag {
case "light":
lesBackend, err := les.New(stack, &cfg)
if err != nil {
return fmt.Errorf("Failed to register the Ethereum service: %w", err)
}
if *statsFlag != "" {
if err := ethstats.New(stack, lesBackend.ApiBackend, lesBackend.Engine(), *statsFlag); err != nil {
return err
}
case "fast", "full":
ethBackend, err := eth.New(stack, &cfg)
if err != nil {
return fmt.Errorf("Failed to register the Ethereum service: %w", err)
}
}
case "fast", "full":
ethBackend, err := eth.New(stack, &cfg)
if err != nil {
return fmt.Errorf("Failed to register the Ethereum service: %w", err)
}
if *statsFlag != "" {
if err := ethstats.New(stack, ethBackend.APIBackend, ethBackend.Engine(), *statsFlag); err != nil {
return err
}
default:
panic("impossible to reach, this should be handled in the auditFlagUse function")
}
default:
panic("impossible to reach, this should be handled in the auditFlagUse function")
}

// Boot up the client and ensure it connects to bootnodes
Expand Down

0 comments on commit e90b9a1

Please sign in to comment.