aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/storage/ldbstore_test.go
diff options
context:
space:
mode:
authorAnton Evangelatov <anton.evangelatov@gmail.com>2018-08-14 22:03:56 +0800
committerBalint Gabor <balint.g@gmail.com>2018-08-14 22:03:56 +0800
commit97887d98da703a31040bceee13bce9ee77fca673 (patch)
treeffc9a8a6fba087b26d33c0ef6c939a19aaaad8c9 /swarm/storage/ldbstore_test.go
parent8a040de60bd6b740ebe87cd8e1fe6bfdb6635d2f (diff)
downloadgo-tangerine-97887d98da703a31040bceee13bce9ee77fca673.tar
go-tangerine-97887d98da703a31040bceee13bce9ee77fca673.tar.gz
go-tangerine-97887d98da703a31040bceee13bce9ee77fca673.tar.bz2
go-tangerine-97887d98da703a31040bceee13bce9ee77fca673.tar.lz
go-tangerine-97887d98da703a31040bceee13bce9ee77fca673.tar.xz
go-tangerine-97887d98da703a31040bceee13bce9ee77fca673.tar.zst
go-tangerine-97887d98da703a31040bceee13bce9ee77fca673.zip
swarm/network, swarm/storage: validate chunk size (#17397)
* swarm/network, swarm/storage: validate default chunk size * swarm/bmt, swarm/network, swarm/storage: update BMT hash initialisation * swarm/bmt: move segmentCount to tests * swarm/chunk: change chunk.DefaultSize to be untyped const * swarm/storage: add size validator * swarm/storage: add chunk size validation to localstore * swarm/storage: move validation from localstore to validator * swarm/storage: global chunk rules in MRU
Diffstat (limited to 'swarm/storage/ldbstore_test.go')
-rw-r--r--swarm/storage/ldbstore_test.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/swarm/storage/ldbstore_test.go b/swarm/storage/ldbstore_test.go
index baf9e8c14..5ee88baa5 100644
--- a/swarm/storage/ldbstore_test.go
+++ b/swarm/storage/ldbstore_test.go
@@ -27,6 +27,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/swarm/chunk"
"github.com/ethereum/go-ethereum/swarm/log"
"github.com/ethereum/go-ethereum/swarm/storage/mock/mem"
@@ -184,7 +185,7 @@ func testIterator(t *testing.T, mock bool) {
t.Fatalf("init dbStore failed: %v", err)
}
- chunks := GenerateRandomChunks(DefaultChunkSize, chunkcount)
+ chunks := GenerateRandomChunks(chunk.DefaultSize, chunkcount)
wg := &sync.WaitGroup{}
wg.Add(len(chunks))
@@ -294,7 +295,7 @@ func TestLDBStoreWithoutCollectGarbage(t *testing.T) {
chunks := []*Chunk{}
for i := 0; i < n; i++ {
- c := GenerateRandomChunk(DefaultChunkSize)
+ c := GenerateRandomChunk(chunk.DefaultSize)
chunks = append(chunks, c)
log.Trace("generate random chunk", "idx", i, "chunk", c)
}
@@ -344,7 +345,7 @@ func TestLDBStoreCollectGarbage(t *testing.T) {
chunks := []*Chunk{}
for i := 0; i < n; i++ {
- c := GenerateRandomChunk(DefaultChunkSize)
+ c := GenerateRandomChunk(chunk.DefaultSize)
chunks = append(chunks, c)
log.Trace("generate random chunk", "idx", i, "chunk", c)
}
@@ -398,7 +399,7 @@ func TestLDBStoreAddRemove(t *testing.T) {
chunks := []*Chunk{}
for i := 0; i < n; i++ {
- c := GenerateRandomChunk(DefaultChunkSize)
+ c := GenerateRandomChunk(chunk.DefaultSize)
chunks = append(chunks, c)
log.Trace("generate random chunk", "idx", i, "chunk", c)
}
@@ -460,7 +461,7 @@ func TestLDBStoreRemoveThenCollectGarbage(t *testing.T) {
chunks := []*Chunk{}
for i := 0; i < capacity; i++ {
- c := GenerateRandomChunk(DefaultChunkSize)
+ c := GenerateRandomChunk(chunk.DefaultSize)
chunks = append(chunks, c)
log.Trace("generate random chunk", "idx", i, "chunk", c)
}