Skip to content

Commit 197ecae

Browse files
committed
refactor: return nil instead of an empty record when processing an invalid record
1 parent 05306f1 commit 197ecae

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

wire/messages.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ func (pm *ProtocolMessenger) GetValue(ctx context.Context, p peer.ID, key string
104104
if err != nil {
105105
logger.Debug("received invalid record (discarded)")
106106
// return a sentinel to signify an invalid record was received
107-
err = internal.ErrInvalidRecord
108-
rec = new(recpb.Record)
107+
return nil, peers, internal.ErrInvalidRecord
109108
}
110109
return rec, peers, err
111110
}

0 commit comments

Comments
 (0)