diff --git a/lib/mergeset/block_header.go b/lib/mergeset/block_header.go index ce4c8dd51..a957427ae 100644 --- a/lib/mergeset/block_header.go +++ b/lib/mergeset/block_header.go @@ -167,7 +167,7 @@ func unmarshalBlockHeadersNoCopy(dst []blockHeader, src []byte, blockHeadersCoun for i := 0; i < blockHeadersCount; i++ { tail, err := dst[dstLen+i].UnmarshalNoCopy(src) if err != nil { - return dst, fmt.Errorf("cannot unmarshal block header: %w", err) + return dst, fmt.Errorf("cannot unmarshal block header #%d out of %d: %w", i, blockHeadersCount, err) } src = tail } diff --git a/lib/mergeset/block_stream_reader.go b/lib/mergeset/block_stream_reader.go index 7e21cf44c..528a89017 100644 --- a/lib/mergeset/block_stream_reader.go +++ b/lib/mergeset/block_stream_reader.go @@ -297,8 +297,9 @@ func (bsr *blockStreamReader) readNextBHS() error { // Unmarshal the unpacked index block into bsr.bhs. bsr.bhs, err = unmarshalBlockHeadersNoCopy(bsr.bhs[:0], bsr.unpackedBuf, int(mr.blockHeadersCount)) if err != nil { - return fmt.Errorf("cannot unmarshal blockHeader #%d in the index block #%d: %w", len(bsr.bhs), bsr.mrIdx, err) + return fmt.Errorf("cannot unmarshal blockHeaders in the index block #%d: %w", bsr.mrIdx, err) } + bsr.bhIdx = 0 return nil }