diff --git a/beacon-chain/node/node.go b/beacon-chain/node/node.go index 62069b9af..e08a8c7c7 100644 --- a/beacon-chain/node/node.go +++ b/beacon-chain/node/node.go @@ -448,6 +448,11 @@ func (b *BeaconNode) startSlasherDB(cliCtx *cli.Context) error { return nil } baseDir := cliCtx.String(cmd.DataDirFlag.Name) + + if cliCtx.IsSet(flags.SlasherDirFlag.Name) { + baseDir = cliCtx.String(flags.SlasherDirFlag.Name) + } + dbPath := filepath.Join(baseDir, kv.BeaconNodeDbDirName) clearDB := cliCtx.Bool(cmd.ClearDB.Name) forceClearDB := cliCtx.Bool(cmd.ForceClearDB.Name) diff --git a/cmd/beacon-chain/flags/base.go b/cmd/beacon-chain/flags/base.go index 8b3e1e6a9..76d5154ea 100644 --- a/cmd/beacon-chain/flags/base.go +++ b/cmd/beacon-chain/flags/base.go @@ -5,6 +5,7 @@ package flags import ( "strings" + "github.com/prysmaticlabs/prysm/v3/cmd" "github.com/prysmaticlabs/prysm/v3/config/params" "github.com/urfave/cli/v2" ) @@ -246,4 +247,10 @@ var ( "WARNING: This flag should be used only if you have a clear understanding that community has decided to override the terminal block hash activation epoch. " + "Incorrect usage will result in your node experience consensus failure.", } + // SlasherDirFlag defines a path on disk where the slasher database is stored. + SlasherDirFlag = &cli.StringFlag{ + Name: "slasher-datadir", + Usage: "Directory for the slasher database", + Value: cmd.DefaultDataDir(), + } ) diff --git a/cmd/beacon-chain/main.go b/cmd/beacon-chain/main.go index bbdb41101..976b5bc26 100644 --- a/cmd/beacon-chain/main.go +++ b/cmd/beacon-chain/main.go @@ -130,6 +130,7 @@ var appFlags = []cli.Flag{ checkpoint.RemoteURL, genesis.StatePath, genesis.BeaconAPIURL, + flags.SlasherDirFlag, } func init() { diff --git a/cmd/beacon-chain/usage.go b/cmd/beacon-chain/usage.go index 8e67f4a56..d3ac45402 100644 --- a/cmd/beacon-chain/usage.go +++ b/cmd/beacon-chain/usage.go @@ -126,6 +126,7 @@ var appHelpFlagGroups = []flagGroup{ flags.MaxBuilderEpochMissedSlots, flags.MaxBuilderConsecutiveMissedSlots, flags.EngineEndpointTimeoutSeconds, + flags.SlasherDirFlag, checkpoint.BlockPath, checkpoint.StatePath, checkpoint.RemoteURL,