mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
Add new localStore constructor for tests
This commit is contained in:
parent
debf3f6932
commit
c0c45e3825
1 changed files with 14 additions and 0 deletions
|
|
@ -42,6 +42,20 @@ func NewLocalStore(hash SwarmHasher, params *StoreParams, basekey []byte) (*Loca
|
|||
}, nil
|
||||
}
|
||||
|
||||
func NewTestLocalStore(path string) (*LocalStore, error) {
|
||||
basekey := make([]byte, 32)
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue