diff --git a/chain/store/index.go b/chain/store/index.go index 5807a2705..8361f4db9 100644 --- a/chain/store/index.go +++ b/chain/store/index.go @@ -15,7 +15,7 @@ import ( "github.com/filecoin-project/lotus/lib/shardedmutex" ) -// DefaultChainIndexCacheSize no longer sets the maximum size, just the inital size of the map. +// DefaultChainIndexCacheSize no longer sets the maximum size, just the initial size of the map. var DefaultChainIndexCacheSize = 1 << 15 func init() { diff --git a/lib/shardedmutex/shardedmutex.go b/lib/shardedmutex/shardedmutex.go index 47b677f51..922ac3994 100644 --- a/lib/shardedmutex/shardedmutex.go +++ b/lib/shardedmutex/shardedmutex.go @@ -20,12 +20,12 @@ type ShardedMutex struct { } // New creates a new ShardedMutex with N shards -func New(n_shards int) ShardedMutex { - if n_shards < 1 { +func New(nShards int) ShardedMutex { + if nShards < 1 { panic("n_shards cannot be less than 1") } return ShardedMutex{ - shards: make([]paddedMutex, n_shards), + shards: make([]paddedMutex, nShards), } } @@ -52,9 +52,9 @@ type ShardedMutexFor[K any] struct { seed maphash.Seed } -func NewFor[K any](hasher func(maphash.Seed, K) uint64, n_shards int) ShardedMutexFor[K] { +func NewFor[K any](hasher func(maphash.Seed, K) uint64, nShards int) ShardedMutexFor[K] { return ShardedMutexFor[K]{ - inner: New(n_shards), + inner: New(nShards), hasher: hasher, seed: maphash.MakeSeed(), }