From 4a923691e74b34e058aeb74fc767e1400502758f Mon Sep 17 00:00:00 2001 From: lash Date: Sat, 11 Nov 2017 17:35:53 +0100 Subject: [PATCH] swarm/storage: Add commend on count increment on open Rebase on master --- swarm/storage/dbstore.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/swarm/storage/dbstore.go b/swarm/storage/dbstore.go index 4dec144755..2c4ec25cf7 100644 --- a/swarm/storage/dbstore.go +++ b/swarm/storage/dbstore.go @@ -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 {