add sanitize logging

This commit is contained in:
Brindrajsinh-Chauhan 2024-05-06 15:18:42 -04:00
parent 1dcf9e5515
commit dae311f84f

View file

@ -164,6 +164,7 @@ func (c *Config) sanitize() Config {
conf := *c conf := *c
if conf.CommitThreshold == 0 { if conf.CommitThreshold == 0 {
log.Warn("Sanitizing commit threshold", "provided", conf.CommitThreshold, "updated", defaultCommitThreshold)
conf.CommitThreshold = defaultCommitThreshold conf.CommitThreshold = defaultCommitThreshold
} }
return conf return conf
@ -209,14 +210,12 @@ type Tree struct {
func New(config Config, diskdb ethdb.KeyValueStore, triedb *triedb.Database, root common.Hash) (*Tree, error) { func New(config Config, diskdb ethdb.KeyValueStore, triedb *triedb.Database, root common.Hash) (*Tree, error) {
// Create a new, empty snapshot tree // Create a new, empty snapshot tree
snap := &Tree{ snap := &Tree{
config: config, config: config.sanitize(),
diskdb: diskdb, diskdb: diskdb,
triedb: triedb, triedb: triedb,
layers: make(map[common.Hash]snapshot), layers: make(map[common.Hash]snapshot),
} }
config = config.sanitize()
// Attempt to load a previously persisted snapshot and rebuild one if failed // Attempt to load a previously persisted snapshot and rebuild one if failed
head, disabled, err := loadSnapshot(diskdb, triedb, root, config.CacheSize, config.Recovery, config.NoBuild) head, disabled, err := loadSnapshot(diskdb, triedb, root, config.CacheSize, config.Recovery, config.NoBuild)
if disabled { if disabled {