prysm-pulse/cmd/beacon-chain/blockchain/options.go
Raul Jordan 975f0ea1af
[Service Config Revamp] - Blockchain Initialization (#9783)
* viz

* unexport config

* builds

* viz

* viz

* register cfg

* fuzz

* blockchain opts

* deepsource

* rename flag opts
2021-10-18 17:48:05 +00:00

25 lines
755 B
Go

package blockchaincmd
import (
"github.com/prysmaticlabs/prysm/beacon-chain/blockchain"
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/cmd"
"github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags"
"github.com/urfave/cli/v2"
)
// FlagOptions for blockchain service flag configurations.
func FlagOptions(c *cli.Context) ([]blockchain.Option, error) {
wsp := c.String(flags.WeakSubjectivityCheckpt.Name)
wsCheckpt, err := helpers.ParseWeakSubjectivityInputString(wsp)
if err != nil {
return nil, err
}
maxRoutines := c.Int(cmd.MaxGoroutines.Name)
opts := []blockchain.Option{
blockchain.WithMaxGoroutines(maxRoutines),
blockchain.WithWeakSubjectivityCheckpoint(wsCheckpt),
}
return opts, nil
}