Commit ae036e06 authored by acud's avatar acud Committed by GitHub

fix(postage): dont swallow error (#1762)

parent bec3daec
...@@ -159,7 +159,7 @@ func TestBatchStoreUnreserveAll(t *testing.T) { ...@@ -159,7 +159,7 @@ func TestBatchStoreUnreserveAll(t *testing.T) {
n := rand.Intn(len(batches)) n := rand.Intn(len(batches))
b, err = bStore.Get(batches[n]) b, err = bStore.Get(batches[n])
if err != nil { if err != nil {
if errors.Is(storage.ErrNotFound, err) { if errors.Is(err, storage.ErrNotFound) {
continue continue
} }
t.Fatal(err) t.Fatal(err)
......
...@@ -7,6 +7,7 @@ package postage ...@@ -7,6 +7,7 @@ package postage
import ( import (
"bytes" "bytes"
"errors" "errors"
"fmt"
"github.com/ethersphere/bee/pkg/crypto" "github.com/ethersphere/bee/pkg/crypto"
"github.com/ethersphere/bee/pkg/storage" "github.com/ethersphere/bee/pkg/storage"
...@@ -115,12 +116,12 @@ func ValidStamp(batchStore Storer) func(chunk swarm.Chunk, stampBytes []byte) (s ...@@ -115,12 +116,12 @@ func ValidStamp(batchStore Storer) func(chunk swarm.Chunk, stampBytes []byte) (s
b, err := batchStore.Get(stamp.BatchID()) b, err := batchStore.Get(stamp.BatchID())
if err != nil { if err != nil {
if errors.Is(err, storage.ErrNotFound) { if errors.Is(err, storage.ErrNotFound) {
return nil, ErrNotFound return nil, fmt.Errorf("batchstore get: %v, %w", err, ErrNotFound)
} }
return nil, err return nil, err
} }
if err = stamp.Valid(chunk.Address(), b.Owner); err != nil { if err = stamp.Valid(chunk.Address(), b.Owner); err != nil {
return nil, err return nil, fmt.Errorf("chunk %s stamp invalid: %w", chunk.Address().String(), err)
} }
return chunk.WithStamp(stamp).WithBatch(b.Radius, b.Depth), nil return chunk.WithStamp(stamp).WithBatch(b.Radius, b.Depth), nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment