diff --git a/pkg/storer/internal/reserve/reserve.go b/pkg/storer/internal/reserve/reserve.go index 47f64dfffd5..e8df91320d0 100644 --- a/pkg/storer/internal/reserve/reserve.go +++ b/pkg/storer/internal/reserve/reserve.go @@ -99,8 +99,6 @@ func New( // if the new chunk has a higher stamp timestamp (regardless of batch type and chunk type, eg CAC & SOC). func (r *Reserve) Put(ctx context.Context, chunk swarm.Chunk) error { - chunkType := storage.ChunkType(chunk) - // batchID lock, Put vs Eviction r.multx.Lock(string(chunk.Stamp().BatchID())) defer r.multx.Unlock(string(chunk.Stamp().BatchID())) @@ -119,6 +117,8 @@ func (r *Reserve) Put(ctx context.Context, chunk swarm.Chunk) error { return nil } + chunkType := storage.ChunkType(chunk) + bin := swarm.Proximity(r.baseAddr.Bytes(), chunk.Address().Bytes()) // bin lock diff --git a/pkg/storer/internal/reserve/reserve_test.go b/pkg/storer/internal/reserve/reserve_test.go index b06c9658206..65ba6d55822 100644 --- a/pkg/storer/internal/reserve/reserve_test.go +++ b/pkg/storer/internal/reserve/reserve_test.go @@ -985,7 +985,12 @@ func checkChunk(t *testing.T, s transaction.ReadOnlyStore, ch swarm.Chunk, gone t.Fatal(err) } - _, err = chunkstamp.LoadWithBatchID(s.IndexStore(), "reserve", ch.Address(), ch.Stamp().BatchID()) + hash, err := ch.Stamp().Hash() + if err != nil { + t.Fatal(err) + } + + _, err = chunkstamp.LoadWithStampHash(s.IndexStore(), "reserve", ch.Address(), hash) if !gone && err != nil { t.Fatal(err) } diff --git a/pkg/storer/migration/reserveRepair.go b/pkg/storer/migration/reserveRepair.go index 8a45774e704..ae6838fc1e7 100644 --- a/pkg/storer/migration/reserveRepair.go +++ b/pkg/storer/migration/reserveRepair.go @@ -199,7 +199,7 @@ func ReserveRepairer( item.BinID = newID(int(item.Bin)) if bytes.Equal(item.StampHash, swarm.EmptyAddress.Bytes()) { - stamp, err := chunkstamp.LoadWithBatchID(s.IndexStore(), "reserve", item.Address, item.BatchID) + stamp, err := chunkstamp.LoadWithStampHash(s.IndexStore(), "reserve", item.Address, item.StampHash) if err != nil { return err }