swarm/chunk: change chunk.DefaultSize to be untyped const

This commit is contained in:
Anton Evangelatov 2018-08-14 10:52:39 +02:00
parent 275c5d3591
commit 1af15cf52f
3 changed files with 3 additions and 3 deletions

View file

@ -1,5 +1,5 @@
package chunk package chunk
const ( const (
DefaultSize int64 = 4096 DefaultSize = 4096
) )

View file

@ -245,7 +245,7 @@ R:
continue R continue R
default: default:
} }
if len(req.SData) > int(cp.DefaultSize) { if len(req.SData) > cp.DefaultSize {
log.Warn("received chunk is bigger than expected", "len", len(req.SData)) log.Warn("received chunk is bigger than expected", "len", len(req.SData))
continue R continue R
} }

View file

@ -116,7 +116,7 @@ func MakeHashFunc(hash string) SwarmHasher {
return func() SwarmHash { return func() SwarmHash {
hasher := sha3.NewKeccak256 hasher := sha3.NewKeccak256
hasherSize := hasher().Size() hasherSize := hasher().Size()
segmentCount := int(chunk.DefaultSize) / hasherSize segmentCount := chunk.DefaultSize / hasherSize
pool := bmt.NewTreePool(hasher, segmentCount, bmt.PoolSize) pool := bmt.NewTreePool(hasher, segmentCount, bmt.PoolSize)
return bmt.New(pool) return bmt.New(pool)
} }