Skip to content

Commit d4ada47

Browse files
committed
cleanup car handling
1 parent 6693a5d commit d4ada47

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

cmd/relay/bgs/validator.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,10 @@ func (val *Validator) VerifyCommitMessage(ctx context.Context, host *models.PDS,
192192
commit, repoFragment, err := atrepo.LoadFromCAR(ctx, bytes.NewReader([]byte(msg.Blocks)))
193193
if err != nil {
194194
commitVerifyErrors.WithLabelValues(hostname, "car").Inc()
195-
if !val.Sync11ErrorsAreWarnings || commit == nil || repoFragment == nil {
196-
return nil, err
197-
} else {
195+
if val.Sync11ErrorsAreWarnings {
198196
logger.Warn("invalid car", "err", err)
199197
}
198+
return nil, fmt.Errorf("invalid car, %w", err)
200199
}
201200

202201
if commit.Rev != rev.String() {
@@ -409,11 +408,10 @@ func (val *Validator) HandleSync(ctx context.Context, host *models.PDS, msg *atp
409408
commit, err := atrepo.LoadCARCommit(ctx, bytes.NewReader([]byte(msg.Blocks)))
410409
if err != nil {
411410
commitVerifyErrors.WithLabelValues(hostname, "car").Inc()
412-
if !val.Sync11ErrorsAreWarnings || commit == nil {
413-
return nil, err
414-
} else {
411+
if val.Sync11ErrorsAreWarnings {
415412
logger.Warn("invalid car", "err", err)
416413
}
414+
return nil, fmt.Errorf("invalid car, %w", err)
417415
}
418416

419417
if commit.Rev != rev.String() {

0 commit comments

Comments
 (0)