swarm/storage: Add commend on count increment on open

Rebase on master
This commit is contained in:
lash 2017-11-11 17:35:53 +01:00
parent e833eb86eb
commit 4a923691e7

View file

@ -93,6 +93,8 @@ func NewDbStore(path string, hash SwarmHasher, capacity uint64, radius int) (s *
s.gcStartPos[0] = kpIndex
s.gcArray = make([]*gcItem, gcArraySize)
// the database closes with pointer to last entry stored
// we increment upon open so that the last entry doesn't get overwritten
data, _ := s.db.Get(keyEntryCnt)
s.entryCnt = BytesToU64(data)
if len(data) > 0 {