Skip to content

Commit

Permalink
Update dtsync head error message
Browse files Browse the repository at this point in the history
If the head protocol is not supported, only an error that contains the correct protocol name.
  • Loading branch information
gammazero committed Sep 15, 2023
1 parent cacbccc commit 5c3396c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dagsync/dtsync/head/head.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ func QueryRootCid(ctx context.Context, host host.Host, topic string, peerID peer
// If protocol ID is wrong, then try the previous protocol ID.
var errNoSupport multistream.ErrNotSupported[protocol.ID]
if errors.As(err, &errNoSupport) {
origErr := err
oldProtoID := previousProtocolID(topic)
conn, err = gostream.Dial(ctx, host, peerID, oldProtoID)
if err != nil {
return nil, err
return nil, origErr
}
log.Infow("Peer head CID server uses old protocol ID", "peer", peerID, "proto", oldProtoID)
} else {
Expand Down

0 comments on commit 5c3396c

Please sign in to comment.