Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Brindrajsinh-Chauhan committed May 7, 2024
1 parent 0b8f159 commit 0a6097e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ type CacheConfig struct {
TrieTimeLimit time.Duration // Time limit after which to flush the current in-memory trie to disk
SnapshotLimit int // Memory allowance (MB) to use for caching snapshot entries in memory
Preimages bool // Whether to store preimage of trie key to the disk
AllowForceUpdate bool // Enable to force snapshots based on commit counts
CommitThreshold int // Number of commits to force a root snapshot
AllowForceUpdate bool // Enable to force root snapshots based on the configured commits threshold
CommitThreshold int // Threshold of commits to force a root snapshot update

SnapshotWait bool // Wait for snapshot construction on startup. TODO(karalabe): This is a dirty hack for testing, nuke it
}
Expand Down
2 changes: 1 addition & 1 deletion core/state/snapshot/difflayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var (
bloomAccountHasherOffset = 0
bloomStorageHasherOffset = 0

// Count for number of commits before fore disk root update
// Count for number of commits before forcing disk root update
defaultCommitThreshold = 128
)

Expand Down
10 changes: 4 additions & 6 deletions core/state/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ type Config struct {
Recovery bool // Indicator that the snapshots is in the recovery mode
ReBuild bool // Indicator that the snapshots generation is disallowed
AsyncBuild bool // The snapshot generation is allowed to be constructed asynchronously
AllowForceUpdate bool // Enable forcing snap root generation on a commit count
CommitThreshold int // Number of commit after which to attempt snap root update
AllowForceUpdate bool // Enable to force root snapshots based on the configured commits threshold
CommitThreshold int // Threshold of commits to force a root snapshot update
}

// sanitize checks the provided user configurations and changes anything that's
Expand All @@ -163,7 +163,7 @@ func (c *Config) sanitize() Config {
conf := *c

if conf.CommitThreshold == 0 {
log.Warn("Sanitizing invalid commit threshold to default", "defaultThreshold", defaultCommitThreshold)
log.Warn("Sanitizing commit threshold", "provided", conf.CommitThreshold, "updated", defaultCommitThreshold)
conf.CommitThreshold = defaultCommitThreshold
}
return conf
Expand Down Expand Up @@ -198,12 +198,10 @@ type Tree struct {
// continuous with disk layer or the journal is missing, all diffs will be discarded
// iff it's in "recovery" mode, otherwise rebuild is mandatory.
func New(config Config, diskdb ethdb.KeyValueStore, triedb *trie.Database, root common.Hash) (*Tree, error) {

Check failure on line 200 in core/state/snapshot/snapshot.go

View workflow job for this annotation

GitHub Actions / Code linters

unnecessary leading newline (whitespace)
// apply default to config and fix invalid values
conf := config.sanitize()

// Create a new, empty snapshot tree
snap := &Tree{
config: conf,
config: config.sanitize(),
diskdb: diskdb,
triedb: triedb,
cache: config.CacheSize,
Expand Down

0 comments on commit 0a6097e

Please sign in to comment.