change default and fix test

This commit is contained in:
Jonathan Gimeno 2020-02-27 15:56:07 +01:00
parent cfb3819183
commit 2f55b9d255
2 changed files with 6 additions and 4 deletions

View File

@ -83,6 +83,8 @@ which accepts a path for the resulting pprof file.
cmd.Flags().String(flagAddress, "tcp://0.0.0.0:26658", "Listen address")
cmd.Flags().String(flagTraceStore, "", "Enable KVStore tracing to an output file")
cmd.Flags().String(flagPruning, "syncable", "Pruning strategy: syncable, nothing, everything")
cmd.Flags().Int64(flagPruningKeepEvery, 0, "Define the state number that will be kept")
cmd.Flags().Int64(flagPruningSnapshotEvery, 0, "Defines the state that will be snapshot for pruning")
cmd.Flags().String(
FlagMinGasPrices, "",
"Minimum gas prices to accept for transactions; Any fee in a tx must meet this minimum (e.g. 0.01photino;0.0001stake)",
@ -101,7 +103,7 @@ which accepts a path for the resulting pprof file.
// checkPruningParams checks that the provided pruning params are correct
func checkPruningParams() error {
if !viper.IsSet(flagPruning) && !viper.IsSet(flagPruningKeepEvery) && !viper.IsSet(flagPruningSnapshotEvery) {
return errPruningOptionsRequired
return nil // Use default
}
if viper.IsSet(flagPruning) {

View File

@ -17,10 +17,10 @@ func TestPruningOptions(t *testing.T) {
expectedErr error
}{
{
name: "none set",
name: "none set, returns nil and will use default from flags",
paramInit: func() {},
returnsErr: true,
expectedErr: errPruningOptionsRequired,
returnsErr: false,
expectedErr: nil,
},
{
name: "only keep-every provided",