mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
* Migrate Prysm repo to Offchain Labs organization ahead of Pectra upgrade v6 * Replace prysmaticlabs with OffchainLabs on general markdowns * Update mock * Gazelle and add mock.go to excluded generated mock file
30 lines
1.1 KiB
Go
30 lines
1.1 KiB
Go
package backfill
|
|
|
|
import (
|
|
"github.com/OffchainLabs/prysm/v6/beacon-chain/node"
|
|
"github.com/OffchainLabs/prysm/v6/beacon-chain/sync/backfill"
|
|
"github.com/OffchainLabs/prysm/v6/cmd/beacon-chain/sync/backfill/flags"
|
|
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
// BeaconNodeOptions sets the appropriate functional opts on the *node.BeaconNode value, to decouple options
|
|
// from flag parsing.
|
|
func BeaconNodeOptions(c *cli.Context) ([]node.Option, error) {
|
|
opt := func(node *node.BeaconNode) (err error) {
|
|
bno := []backfill.ServiceOption{
|
|
backfill.WithBatchSize(c.Uint64(flags.BackfillBatchSize.Name)),
|
|
backfill.WithWorkerCount(c.Int(flags.BackfillWorkerCount.Name)),
|
|
backfill.WithEnableBackfill(c.Bool(flags.EnableExperimentalBackfill.Name)),
|
|
}
|
|
// The zero value of this uint flag would be genesis, so we use IsSet to differentiate nil from zero case.
|
|
if c.IsSet(flags.BackfillOldestSlot.Name) {
|
|
uv := c.Uint64(flags.BackfillOldestSlot.Name)
|
|
bno = append(bno, backfill.WithMinimumSlot(primitives.Slot(uv)))
|
|
}
|
|
node.BackfillOpts = bno
|
|
return nil
|
|
}
|
|
return []node.Option{opt}, nil
|
|
}
|