diff --git a/swarm/storage/dbstore.go b/swarm/storage/dbstore.go index d559a7b27b..ec2ac57454 100644 --- a/swarm/storage/dbstore.go +++ b/swarm/storage/dbstore.go @@ -542,10 +542,11 @@ func (s *DbStore) doPut(chunk *Chunk, ikey []byte, index *dpaDBIndex, po uint8) data := encodeData(chunk) s.batch.Put(getDataKey(s.dataIdx, po), data) index.Idx = s.dataIdx + s.bucketCnt[po] = s.dataIdx s.entryCnt++ s.dataIdx++ - s.bucketCnt[po]++ + // s.bucketCnt[po]++ cntKey := make([]byte, 2) cntKey[0] = keyDistanceCnt cntKey[1] = po diff --git a/swarm/storage/localstore.go b/swarm/storage/localstore.go index 32c495ac8a..30b95780f5 100644 --- a/swarm/storage/localstore.go +++ b/swarm/storage/localstore.go @@ -56,6 +56,19 @@ func NewTestLocalStore(path string) (*LocalStore, error) { return localStore, nil } +func NewTestLocalStoreForAddr(path string, basekey []byte) (*LocalStore, error) { + hasher := MakeHashFunc("SHA3") + dbStore, err := NewDbStore(path, hasher, singletonSwarmDbCapacity, func(k Key) (ret uint8) { return uint8(Proximity(basekey[:], k[:])) }) + if err != nil { + return nil, err + } + localStore := &LocalStore{ + memStore: NewMemStore(dbStore, singletonSwarmDbCapacity), + DbStore: dbStore, + } + return localStore, nil +} + // LocalStore is itself a chunk store // unsafe, in that the data is not integrity checked func (self *LocalStore) Put(chunk *Chunk) {