From 1af15cf52f36018a9cf0a241b3bf25324a29ab7b Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Tue, 14 Aug 2018 10:52:39 +0200 Subject: [PATCH] swarm/chunk: change chunk.DefaultSize to be untyped const --- swarm/chunk/chunk.go | 2 +- swarm/network/stream/delivery.go | 2 +- swarm/storage/types.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/swarm/chunk/chunk.go b/swarm/chunk/chunk.go index 606153aa26..1449efccd0 100644 --- a/swarm/chunk/chunk.go +++ b/swarm/chunk/chunk.go @@ -1,5 +1,5 @@ package chunk const ( - DefaultSize int64 = 4096 + DefaultSize = 4096 ) diff --git a/swarm/network/stream/delivery.go b/swarm/network/stream/delivery.go index ad74e32c34..91212cebde 100644 --- a/swarm/network/stream/delivery.go +++ b/swarm/network/stream/delivery.go @@ -245,7 +245,7 @@ R: continue R 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)) continue R } diff --git a/swarm/storage/types.go b/swarm/storage/types.go index b1354bfe56..3d0cf2caf2 100644 --- a/swarm/storage/types.go +++ b/swarm/storage/types.go @@ -116,7 +116,7 @@ func MakeHashFunc(hash string) SwarmHasher { return func() SwarmHash { hasher := sha3.NewKeccak256 hasherSize := hasher().Size() - segmentCount := int(chunk.DefaultSize) / hasherSize + segmentCount := chunk.DefaultSize / hasherSize pool := bmt.NewTreePool(hasher, segmentCount, bmt.PoolSize) return bmt.New(pool) }