From 7e7e5ef8dc68901e23f2a8313f55e60ea2050156 Mon Sep 17 00:00:00 2001 From: Janos Guljas Date: Thu, 21 Feb 2019 14:20:21 +0100 Subject: [PATCH] swarm/storage/localstore: better want check in readPullSubscriptionBin --- swarm/storage/localstore/subscription_pull_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/swarm/storage/localstore/subscription_pull_test.go b/swarm/storage/localstore/subscription_pull_test.go index c8649bb834..958d71e50b 100644 --- a/swarm/storage/localstore/subscription_pull_test.go +++ b/swarm/storage/localstore/subscription_pull_test.go @@ -445,12 +445,13 @@ func readPullSubscriptionBin(ctx context.Context, bin uint8, ch <-chan ChunkDesc addrsMu.Lock() if i+1 > len(addrs[bin]) { err = fmt.Errorf("got more chunk addresses %v, then expected %v, for bin %v", i+1, len(addrs[bin]), bin) + } else { + want := addrs[bin][i] + if !bytes.Equal(got.Address, want) { + err = fmt.Errorf("got chunk address %v in bin %v %s, want %s", i, bin, got.Address.Hex(), want) + } } - want := addrs[bin][i] addrsMu.Unlock() - if err == nil && !bytes.Equal(got.Address, want) { - err = fmt.Errorf("got chunk address %v in bin %v %s, want %s", i, bin, got.Address.Hex(), want) - } i++ // send one and only one error per received address select {