diff --git a/server/config/config.go b/server/config/config.go index abb43a9b11..fc9ead54b4 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" + "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -77,7 +78,7 @@ func DefaultConfig() *Config { BaseConfig{ MinGasPrices: defaultMinGasPrices, InterBlockCache: true, - Pruning: "syncable", + Pruning: store.PruningStrategySyncable, }, } } diff --git a/server/config/toml.go b/server/config/toml.go index 45f76ee13a..c0e27c69c8 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -40,7 +40,7 @@ inter-block-cache = {{ .BaseConfig.InterBlockCache }} # syncable: only those states not needed for state syncing will be deleted (keeps last 100 + every 10000th) # nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) # everything: all saved states will be deleted, storing only the current state -pruning = {{ .BaseConfig.Pruning }} +pruning = "{{ .BaseConfig.Pruning }}" ` var configTemplate *template.Template diff --git a/store/store.go b/store/store.go index 27a0c74165..ba03117638 100644 --- a/store/store.go +++ b/store/store.go @@ -8,6 +8,13 @@ import ( "github.com/cosmos/cosmos-sdk/store/types" ) +// Pruning strategies that may be provided to a KVStore to enable pruning. +const ( + PruningStrategyNothing = "nothing" + PruningStrategyEverything = "everything" + PruningStrategySyncable = "syncable" +) + func NewCommitMultiStore(db dbm.DB) types.CommitMultiStore { return rootmulti.NewStore(db) } @@ -18,11 +25,11 @@ func NewCommitKVStoreCacheManager() types.MultiStorePersistentCache { func NewPruningOptionsFromString(strategy string) (opt PruningOptions) { switch strategy { - case "nothing": + case PruningStrategyNothing: opt = PruneNothing - case "everything": + case PruningStrategyEverything: opt = PruneEverything - case "syncable": + case PruningStrategySyncable: opt = PruneSyncable default: opt = PruneSyncable