swarm/storage: fix NewRandomChunk to allocate 8 bytes for chunk length

This commit is contained in:
Anton Evangelatov 2018-04-13 12:30:16 +03:00
parent 4c955d330f
commit 9322249253

View file

@ -144,7 +144,7 @@ func NewRandomChunk(chunkSize uint64) *Chunk {
c := &Chunk{
Key: make([]byte, 32),
ReqC: nil,
SData: make([]byte, chunkSize),
SData: make([]byte, chunkSize+8), // SData should be chunkSize + 8 bytes reserved for length
dbStoredC: make(chan bool),
dbStoredMu: &sync.Mutex{},
}